Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
22 lines
720 B
TypeScript
22 lines
720 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { computeKeyboardInset } from '@/lib/visualViewportKeyboardInset'
|
|
|
|
describe('computeKeyboardInset', () => {
|
|
it('returns 0 when visual viewport matches the layout viewport', () => {
|
|
expect(computeKeyboardInset(800, 800, 0)).toBe(0)
|
|
})
|
|
|
|
it('ignores small chrome/zoom deltas below the keyboard threshold', () => {
|
|
expect(computeKeyboardInset(800, 760, 0)).toBe(0)
|
|
})
|
|
|
|
it('returns the occluded height when a keyboard-sized inset appears', () => {
|
|
expect(computeKeyboardInset(800, 480, 0)).toBe(320)
|
|
})
|
|
|
|
it('subtracts visualViewport.offsetTop (iOS scroll-while-focused)', () => {
|
|
expect(computeKeyboardInset(800, 480, 40)).toBe(280)
|
|
})
|
|
})
|