mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-27 06:13:06 +00:00
- Empty blur → collapsed; blur with text stays FULL (drawer whenEmpty policy). - Handle tap and snap→collapsed clear search so uiFocused cannot reopen FULL. - Keep all snap points while focused so swipe ↓ can dismiss. - Pathname change (in-chrome) clears + collapses; initial load stays dock. - Compact dock/search stack gap (~⅓) without cutting safe-area. Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
homeSearchShouldUnfocusOnBlur,
|
|
homeSearchUiFocused,
|
|
} from '@/lib/campaignHomeSearchContract'
|
|
|
|
describe('homeSearchUiFocused', () => {
|
|
it('is true when the input is focused without an active query', () => {
|
|
expect(homeSearchUiFocused({ inputFocused: true, isActive: false })).toBe(true)
|
|
})
|
|
|
|
it('is true when the query is active even if the input lost focus', () => {
|
|
expect(homeSearchUiFocused({ inputFocused: false, isActive: true })).toBe(true)
|
|
})
|
|
|
|
it('is false when blurred and query inactive', () => {
|
|
expect(homeSearchUiFocused({ inputFocused: false, isActive: false })).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('homeSearchShouldUnfocusOnBlur', () => {
|
|
it('whenEmpty unfocuses only blank raw (B112 drawer)', () => {
|
|
expect(homeSearchShouldUnfocusOnBlur('', 'whenEmpty', false)).toBe(true)
|
|
expect(homeSearchShouldUnfocusOnBlur(' ', 'whenEmpty', false)).toBe(true)
|
|
expect(homeSearchShouldUnfocusOnBlur('c', 'whenEmpty', false)).toBe(false)
|
|
expect(homeSearchShouldUnfocusOnBlur('ca', 'whenEmpty', true)).toBe(false)
|
|
})
|
|
|
|
it('whenInactive follows isActive (Início)', () => {
|
|
expect(homeSearchShouldUnfocusOnBlur('c', 'whenInactive', false)).toBe(true)
|
|
expect(homeSearchShouldUnfocusOnBlur('ca', 'whenInactive', true)).toBe(false)
|
|
})
|
|
})
|