+
{items?.map((item: any) => {item.label})}
+
{activeItem?.children}
+
+ );
+ },
};
});
@@ -205,6 +297,7 @@ describe('QueryEditor external SQL save', () => {
messageApi.success.mockReset();
messageApi.error.mockReset();
messageApi.warning.mockReset();
+ backendApp.DBQuery.mockResolvedValue({ success: true, data: [] });
backendApp.WriteSQLFile.mockResolvedValue({ success: true });
backendApp.DBQueryMulti.mockResolvedValue({ success: true, data: [] });
backendApp.DBGetColumns.mockResolvedValue({ success: true, data: [] });
@@ -212,10 +305,18 @@ describe('QueryEditor external SQL save', () => {
backendApp.GenerateQueryID.mockResolvedValue('query-1');
storeState.connections[0].config.type = 'mysql';
storeState.connections[0].config.database = 'main';
+ storeState.appearance.uiVersion = 'legacy';
dataGridState.latestProps = null;
editorState.value = '';
+ editorState.position = { lineNumber: 1, column: 1 };
+ editorState.selection = null;
+ editorState.providers = [];
+ editorState.cursorPositionListeners = [];
+ editorState.hasTextFocus = true;
editorState.editor.getValue.mockClear();
editorState.editor.setValue.mockClear();
+ editorState.editor.executeEdits.mockClear();
+ storeState.updateQueryTabDraft.mockReset();
});
afterEach(() => {
@@ -223,6 +324,29 @@ describe('QueryEditor external SQL save', () => {
vi.clearAllMocks();
});
+ it('shows the default SQL template for a fresh blank query tab', async () => {
+ await act(async () => {
+ create(