mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Do not show hover tooltip when autocomplete is active (#11653)
This commit is contained in:
@@ -242,6 +242,9 @@ export const hoverTooltipSource = (view: EditorView, pos: number) => {
|
||||
const state = view.state.field(cursorInfoBoxTooltip, false);
|
||||
const cursorTooltipOpen = !!state?.tooltip;
|
||||
|
||||
// Don't show hover tooltips when autocomplete is active
|
||||
if (completionStatus(view.state) === 'active') return null;
|
||||
|
||||
const jsNodeResult = getJsNodeAtPosition(view.state, pos);
|
||||
|
||||
if (!jsNodeResult) {
|
||||
|
||||
@@ -6,6 +6,16 @@ import { n8nLang } from '@/plugins/codemirror/n8nLang';
|
||||
import { hoverTooltipSource, infoBoxTooltips } from './InfoBoxTooltip';
|
||||
import * as utils from '@/plugins/codemirror/completions/utils';
|
||||
import * as workflowHelpers from '@/composables/useWorkflowHelpers';
|
||||
import { completionStatus } from '@codemirror/autocomplete';
|
||||
|
||||
vi.mock('@codemirror/autocomplete', async (importOriginal) => {
|
||||
const actual = await importOriginal<{}>();
|
||||
|
||||
return {
|
||||
...actual,
|
||||
completionStatus: vi.fn(() => null),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Infobox tooltips', () => {
|
||||
beforeEach(() => {
|
||||
@@ -99,6 +109,13 @@ describe('Infobox tooltips', () => {
|
||||
expect(tooltip).not.toBeNull();
|
||||
expect(infoBoxHeader(tooltip?.view)).toHaveTextContent('includes(searchString, start?)');
|
||||
});
|
||||
|
||||
test('should not show a tooltip when autocomplete is open', () => {
|
||||
vi.spyOn(workflowHelpers, 'resolveParameter').mockReturnValue('foo');
|
||||
vi.mocked(completionStatus).mockReturnValue('active');
|
||||
const tooltip = hoverTooltip('{{ $json.str.includ|es() }}');
|
||||
expect(tooltip).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user