Files
hermes-desktop/tests/client/chat-input-height.test.ts
T
toor 01d9e301fc
Build / build (push) Canceled after 0s
Playwright / browser (push) Canceled after 0s
initialize Electron desktop app and remove unused files
2026-10-25 01:09:01 +08:00

23 lines
888 B
TypeScript

import { describe, expect, it } from 'vitest'
import {
MAX_CHAT_INPUT_HEIGHT,
MIN_CHAT_INPUT_HEIGHT,
clampChatInputHeight,
isMobileChatInputViewport,
} from '@/utils/chat-input-height'
describe('chat input height utils', () => {
it('clamps configured heights into the supported range', () => {
expect(clampChatInputHeight(undefined)).toBeNull()
expect(clampChatInputHeight(null)).toBeNull()
expect(clampChatInputHeight('')).toBeNull()
expect(clampChatInputHeight(MIN_CHAT_INPUT_HEIGHT - 100)).toBe(MIN_CHAT_INPUT_HEIGHT)
expect(clampChatInputHeight(MAX_CHAT_INPUT_HEIGHT + 100)).toBe(MAX_CHAT_INPUT_HEIGHT)
expect(clampChatInputHeight(157.6)).toBe(158)
})
it('treats the existing mobile breakpoint as mobile-only behavior', () => {
expect(isMobileChatInputViewport(768)).toBe(true)
expect(isMobileChatInputViewport(769)).toBe(false)
})
})