mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-14 10:34:02 +08:00
🐛 fix(query-editor): 修复 SQL 片段补全与插入交互
- 插入 SQL 片段后主动关闭片段弹窗,保持右键插入行为一致 - 提升 Monaco 补全详情区最小高度,放大片段说明展示区域 - 列补全解析改为基于当前语句引用上下文,修复当前语句前半段补全丢列问题 - 为 SQL 草稿持久化补齐 window 定时器兜底,避免测试环境 clearTimeout 缺失 - 更新 SQL 片段弹窗关闭和补全说明高度相关回归测试
This commit is contained in:
@@ -3642,7 +3642,7 @@ describe('QueryEditor external SQL save', () => {
|
||||
})],
|
||||
);
|
||||
expect(editorState.value).toBe('SELECT id FROM user_table;');
|
||||
expect(renderer.root.findByProps({ 'data-query-editor-snippet-picker': 'true' })).toBeTruthy();
|
||||
expect(renderer.root.findAllByProps({ 'data-query-editor-snippet-picker': 'true' })).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('prefers Monaco snippet controller insertion when the controller is available', async () => {
|
||||
@@ -3695,7 +3695,7 @@ describe('QueryEditor external SQL save', () => {
|
||||
);
|
||||
expect(editorState.editor.executeEdits).not.toHaveBeenCalled();
|
||||
expect(editorState.value).toBe('ALTER TABLE demo_table\nADD COLUMN user_name VARCHAR(255);');
|
||||
expect(renderer.root.findByProps({ 'data-query-editor-snippet-picker': 'true' })).toBeTruthy();
|
||||
expect(renderer.root.findAllByProps({ 'data-query-editor-snippet-picker': 'true' })).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('keeps the SQL snippet picker modal non-mask-closable to avoid immediate close after context-menu click', () => {
|
||||
@@ -8892,6 +8892,24 @@ describe('QueryEditor external SQL save', () => {
|
||||
expect(css).not.toContain('body[data-ui-version="v2"] .gn-v2-query-monaco-stage .monaco-editor .find-widget {');
|
||||
});
|
||||
|
||||
it('raises QueryEditor suggest docs height for SQL snippet completion without widening global Monaco defaults', () => {
|
||||
const appCss = readFileSync(new URL('../App.css', import.meta.url), 'utf8');
|
||||
|
||||
expect(queryEditorSource).toContain('QUERY_EDITOR_SQL_SNIPPET_SUGGEST_DETAIL_MIN_HEIGHT = 260');
|
||||
expect(queryEditorSource).toContain("editor.getContribution?.('editor.contrib.suggestController')");
|
||||
expect(queryEditorSource).toContain('const originalSuggestDetailsLayout = suggestDetailsWidget.layout.bind(suggestDetailsWidget);');
|
||||
expect(queryEditorSource).toContain('suggestDetailsWidget.layout = (width: number, height: number) => {');
|
||||
expect(queryEditorSource).toContain('Math.max(height, QUERY_EDITOR_SQL_SNIPPET_SUGGEST_DETAIL_MIN_HEIGHT)');
|
||||
expect(queryEditorSource).toContain("className={isV2Ui ? 'gn-v2-query-monaco-stage gn-query-monaco-stage' : 'gn-query-monaco-stage'}");
|
||||
expect(appCss).toContain('.gn-query-monaco-stage .monaco-editor .suggest-details-container {');
|
||||
expect(appCss).toContain('min-height: 260px;');
|
||||
expect(appCss).toContain('.gn-query-monaco-stage .monaco-editor .suggest-details {');
|
||||
expect(appCss).toContain('min-height: 260px;');
|
||||
expect(appCss).not.toContain('.gn-query-monaco-stage .monaco-editor .suggest-widget {');
|
||||
expect(appCss).not.toContain('width: 680px;');
|
||||
expect(appCss).not.toContain('min-width: 560px;');
|
||||
});
|
||||
|
||||
it('keeps the v2 query editor toolbar grouped and compact', () => {
|
||||
const source = readFileSync(new URL('./QueryEditor.tsx', import.meta.url), 'utf8');
|
||||
const toolbarSource = readFileSync(new URL('./QueryEditorToolbar.tsx', import.meta.url), 'utf8');
|
||||
|
||||
Reference in New Issue
Block a user