mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-03 17:31:24 +08:00
🐛 fix(frontend): 修复 Redis 搜索匹配与输入交互体验
- Redis Key 搜索默认补全包含匹配并支持 ASCII 大小写不敏感 - Redis 标签页增加连接名与 host 摘要,区分同名 db 标签 - 抽取 inputAutoCap、redisSearchPattern、tabDisplay 共享工具并补充回归测试 - 覆盖连接配置、Redis 搜索、表设计、表概览和数据表筛选输入的自动纠正问题 - 在 macOS 文本输入面板关闭局部毛玻璃,修复输入法切换出现透明框
This commit is contained in:
70
frontend/src/utils/inputAutoCap.test.ts
Normal file
70
frontend/src/utils/inputAutoCap.test.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { applyNoAutoCapAttributes, applyNoAutoCapAttributesWithin, noAutoCapInputProps } from './inputAutoCap';
|
||||
|
||||
describe('inputAutoCap', () => {
|
||||
it('exports input props that disable auto capitalization and correction', () => {
|
||||
expect(noAutoCapInputProps).toEqual({
|
||||
autoCapitalize: 'none',
|
||||
autoCorrect: 'off',
|
||||
spellCheck: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('applies lowercase DOM attributes to inputs and textareas', () => {
|
||||
const inputAttributes: Record<string, string> = {};
|
||||
const textareaAttributes: Record<string, string> = {};
|
||||
const input = {
|
||||
tagName: 'INPUT',
|
||||
setAttribute: (key: string, value: string) => {
|
||||
inputAttributes[key] = value;
|
||||
},
|
||||
} as unknown as Element;
|
||||
const textarea = {
|
||||
tagName: 'TEXTAREA',
|
||||
setAttribute: (key: string, value: string) => {
|
||||
textareaAttributes[key] = value;
|
||||
},
|
||||
} as unknown as Element;
|
||||
|
||||
applyNoAutoCapAttributes(input);
|
||||
applyNoAutoCapAttributes(textarea);
|
||||
|
||||
expect(inputAttributes.autocapitalize).toBe('none');
|
||||
expect(inputAttributes.autocorrect).toBe('off');
|
||||
expect(inputAttributes.spellcheck).toBe('false');
|
||||
expect(textareaAttributes.autocapitalize).toBe('none');
|
||||
expect(textareaAttributes.autocorrect).toBe('off');
|
||||
expect(textareaAttributes.spellcheck).toBe('false');
|
||||
});
|
||||
|
||||
it('applies no-auto-cap attributes to all nested inputs and textareas within a container', () => {
|
||||
const inputAttributes: Record<string, string> = {};
|
||||
const textareaAttributes: Record<string, string> = {};
|
||||
const input = {
|
||||
tagName: 'INPUT',
|
||||
setAttribute: (key: string, value: string) => {
|
||||
inputAttributes[key] = value;
|
||||
},
|
||||
} as unknown as Element;
|
||||
const textarea = {
|
||||
tagName: 'TEXTAREA',
|
||||
setAttribute: (key: string, value: string) => {
|
||||
textareaAttributes[key] = value;
|
||||
},
|
||||
} as unknown as Element;
|
||||
const root = {
|
||||
querySelectorAll: (selector: string) => {
|
||||
expect(selector).toBe('input, textarea');
|
||||
return [input, textarea];
|
||||
},
|
||||
} as unknown as ParentNode;
|
||||
|
||||
applyNoAutoCapAttributesWithin(root);
|
||||
|
||||
expect(inputAttributes.autocapitalize).toBe('none');
|
||||
expect(inputAttributes.autocorrect).toBe('off');
|
||||
expect(textareaAttributes.autocapitalize).toBe('none');
|
||||
expect(textareaAttributes.autocorrect).toBe('off');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user