🐛 fix(query-editor): 优化工具栏长名称提示与片段弹窗布局

- SQL 编辑器连接和数据库选择器支持悬浮延迟显示完整名称
- SQL 片段管理嵌入工具中心时隐藏重复标题
- 缩小片段操作按钮并拆分滚动区域,避免底部内容被遮挡
- 补充工具栏和片段弹窗源码级回归断言
This commit is contained in:
Syngnat
2026-06-25 18:42:11 +08:00
parent aebe9bab54
commit 8a56367d02
7 changed files with 237 additions and 40 deletions

View File

@@ -79,4 +79,29 @@ describe('QueryEditorToolbar layout', () => {
expect(transactionDelayCss).toContain('width: 104px !important;');
expect(transactionDelayCss).toContain('flex: 0 0 104px !important;');
});
it('shows delayed full-name tooltips for truncated connection and database selectors', () => {
const toolbarSource = readFileSync(new URL('./QueryEditorToolbar.tsx', import.meta.url), 'utf8');
const css = readV2ThemeCss();
const connectionSelectSource = toolbarSource.slice(
toolbarSource.indexOf('gn-v2-query-toolbar-connection-select'),
toolbarSource.indexOf('gn-v2-query-toolbar-database-select'),
);
const databaseSelectSource = toolbarSource.slice(
toolbarSource.indexOf('gn-v2-query-toolbar-database-select'),
toolbarSource.indexOf('gn-v2-query-toolbar-max-rows-select'),
);
expect(toolbarSource).toContain('FULL_NAME_TOOLTIP_DELAY_SECONDS = 1');
expect(toolbarSource).toContain('mouseEnterDelay={FULL_NAME_TOOLTIP_DELAY_SECONDS}');
expect(toolbarSource).toContain('renderFullNameSelectTooltip');
expect(toolbarSource).toContain('gn-query-toolbar-select-full-name');
expect(connectionSelectSource).toContain('optionRender={(option) => renderFullNameSelectTooltip(option.data.fullName)}');
expect(connectionSelectSource).toContain('labelRender={(option) => renderFullNameSelectTooltip(option.label ?? option.value)}');
expect(databaseSelectSource).toContain('optionRender={(option) => renderFullNameSelectTooltip(option.data.fullName)}');
expect(databaseSelectSource).toContain('labelRender={(option) => renderFullNameSelectTooltip(option.label ?? option.value)}');
expect(css).toContain('.gn-query-toolbar-select-full-name {');
expect(css).toContain('text-overflow: ellipsis;');
expect(css).toContain('white-space: nowrap;');
});
});