* fix(ui): add opt-in mobile keyboard resize mode * fix(ui): stabilize touch terminal input and tab layout * fix(ui): narrow touch terminal handling to mobile and tablet * fix(ui): refine touch terminal input handling * fix(ui): re-key terminal viewport on session id * fix(ui): avoid touch-laptop terminal overlay regression * fix(ui): hide ghostty system caret surfaces * fix(settings): normalize mobile keyboard mode sanitization * fix(ui): honor terminal quick keys toggle on mobile * fix(ui): gate mobile keyboard resize mode on iOS --------- Co-authored-by: vhqtvn <8930337+vhqtvn@users.noreply.github.com> Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
75 lines
2.7 KiB
JavaScript
75 lines
2.7 KiB
JavaScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { createSettingsHelpers } from './settings-helpers.js';
|
|
|
|
const createTestHelpers = () => createSettingsHelpers({
|
|
normalizePathForPersistence: (value) => value,
|
|
normalizeDirectoryPath: (value) => value,
|
|
normalizeTunnelBootstrapTtlMs: (value) => value,
|
|
normalizeTunnelSessionTtlMs: (value) => value,
|
|
normalizeTunnelProvider: (value) => value,
|
|
normalizeTunnelMode: (value) => value,
|
|
normalizeOptionalPath: (value) => value,
|
|
normalizeManagedRemoteTunnelHostname: (value) => value,
|
|
normalizeManagedRemoteTunnelPresets: () => undefined,
|
|
normalizeManagedRemoteTunnelPresetTokens: () => undefined,
|
|
sanitizeTypographySizesPartial: () => undefined,
|
|
normalizeStringArray: (input) => input,
|
|
sanitizeModelRefs: () => undefined,
|
|
sanitizeSkillCatalogs: () => undefined,
|
|
sanitizeProjects: () => undefined,
|
|
});
|
|
|
|
describe('settings helpers', () => {
|
|
it('accepts messageStreamTransport as a persisted shared setting', () => {
|
|
const helpers = createTestHelpers();
|
|
|
|
expect(helpers.sanitizeSettingsUpdate({ messageStreamTransport: 'ws' })).toEqual({
|
|
messageStreamTransport: 'ws',
|
|
});
|
|
expect(helpers.sanitizeSettingsUpdate({ messageStreamTransport: 'sse' })).toEqual({
|
|
messageStreamTransport: 'sse',
|
|
});
|
|
expect(helpers.sanitizeSettingsUpdate({ messageStreamTransport: 'auto' })).toEqual({
|
|
messageStreamTransport: 'auto',
|
|
});
|
|
});
|
|
|
|
it('rejects invalid messageStreamTransport values', () => {
|
|
const helpers = createTestHelpers();
|
|
|
|
expect(helpers.sanitizeSettingsUpdate({ messageStreamTransport: 'websocket' })).toEqual({});
|
|
});
|
|
|
|
it('accepts desktopLanAccessEnabled as a persisted shared setting', () => {
|
|
const helpers = createTestHelpers();
|
|
|
|
expect(helpers.sanitizeSettingsUpdate({ desktopLanAccessEnabled: true })).toEqual({
|
|
desktopLanAccessEnabled: true,
|
|
});
|
|
expect(helpers.sanitizeSettingsUpdate({ desktopLanAccessEnabled: false })).toEqual({
|
|
desktopLanAccessEnabled: false,
|
|
});
|
|
});
|
|
|
|
it('accepts mobileKeyboardMode as a persisted shared setting', () => {
|
|
const helpers = createTestHelpers();
|
|
|
|
expect(helpers.sanitizeSettingsUpdate({ mobileKeyboardMode: 'native' })).toEqual({
|
|
mobileKeyboardMode: 'native',
|
|
});
|
|
expect(helpers.sanitizeSettingsUpdate({ mobileKeyboardMode: 'resize-content' })).toEqual({
|
|
mobileKeyboardMode: 'resize-content',
|
|
});
|
|
expect(helpers.sanitizeSettingsUpdate({ mobileKeyboardMode: ' resize-content ' })).toEqual({
|
|
mobileKeyboardMode: 'resize-content',
|
|
});
|
|
});
|
|
|
|
it('rejects invalid mobileKeyboardMode values', () => {
|
|
const helpers = createTestHelpers();
|
|
|
|
expect(helpers.sanitizeSettingsUpdate({ mobileKeyboardMode: 'fixed-layout' })).toEqual({});
|
|
});
|
|
});
|