mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-19 22:15:12 +08:00
✨ feat(settings): 拆分 SQL 编辑器与查询结果字号
- 新增 SQL 编辑器独立字号与跟随全局配置 - 将查询编辑器和 DDL 预览接入 SQL 专用排版 - 迁移旧版耦合字号设置并保留原有视觉大小 - 更新六语种文案并补充持久化与组件测试
This commit is contained in:
42
frontend/src/utils/sqlEditorTypography.test.ts
Normal file
42
frontend/src/utils/sqlEditorTypography.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
migrateLegacySqlEditorTypographySettings,
|
||||
resolveSqlEditorFontSize,
|
||||
sanitizeSqlEditorTypographySettings,
|
||||
} from './sqlEditorTypography';
|
||||
|
||||
describe('SQL editor typography', () => {
|
||||
it('derives a code-sized value while following the global font size', () => {
|
||||
expect(resolveSqlEditorFontSize({
|
||||
globalFontSize: 14,
|
||||
sqlEditorFontSize: 20,
|
||||
sqlEditorFontSizeFollowGlobal: true,
|
||||
})).toBe(13);
|
||||
});
|
||||
|
||||
it('uses and clamps an independent SQL editor font size', () => {
|
||||
expect(resolveSqlEditorFontSize({
|
||||
globalFontSize: 14,
|
||||
sqlEditorFontSize: 99,
|
||||
sqlEditorFontSizeFollowGlobal: false,
|
||||
})).toBe(20);
|
||||
expect(sanitizeSqlEditorTypographySettings({
|
||||
sqlEditorFontSize: 9,
|
||||
sqlEditorFontSizeFollowGlobal: false,
|
||||
})).toEqual({
|
||||
sqlEditorFontSize: 10,
|
||||
sqlEditorFontSizeFollowGlobal: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves the legacy editor size derived from a custom data-table font', () => {
|
||||
expect(migrateLegacySqlEditorTypographySettings({
|
||||
dataTableFontSize: 18,
|
||||
dataTableFontSizeFollowGlobal: false,
|
||||
})).toEqual({
|
||||
sqlEditorFontSize: 17,
|
||||
sqlEditorFontSizeFollowGlobal: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user