diff --git a/cypress/e2e/14-mapping.cy.ts b/cypress/e2e/14-mapping.cy.ts index 02ffef9613..ef3b3aeb60 100644 --- a/cypress/e2e/14-mapping.cy.ts +++ b/cypress/e2e/14-mapping.cy.ts @@ -268,7 +268,6 @@ describe('Data mapping', () => { ndv.actions.typeIntoParameterInput('value', 'fun'); ndv.actions.clearParameterInput('value'); // keep focus on param - ndv.actions.dismissMappingTooltip(); cy.wait(300); ndv.getters.inputDataContainer().should('exist').find('span').contains('count').realMouseDown(); diff --git a/packages/design-system/src/components/N8nTooltip/Tooltip.stories.ts b/packages/design-system/src/components/N8nTooltip/Tooltip.stories.ts index 3e81be9ff0..191d9e4135 100644 --- a/packages/design-system/src/components/N8nTooltip/Tooltip.stories.ts +++ b/packages/design-system/src/components/N8nTooltip/Tooltip.stories.ts @@ -59,7 +59,7 @@ TooltipWithButtons.args = { 'data-test-id': 'tooltip-button', }, listeners: { - click: () => alert('Clicked 1'), + onClick: () => alert('Clicked 1'), }, }, { @@ -68,7 +68,7 @@ TooltipWithButtons.args = { 'data-test-id': 'tooltip-button', }, listeners: { - click: () => alert('Clicked 2'), + onClick: () => alert('Clicked 2'), }, }, ], diff --git a/packages/design-system/src/components/N8nTooltip/__tests__/Tooltip.spec.ts b/packages/design-system/src/components/N8nTooltip/__tests__/Tooltip.spec.ts new file mode 100644 index 0000000000..abcd416f36 --- /dev/null +++ b/packages/design-system/src/components/N8nTooltip/__tests__/Tooltip.spec.ts @@ -0,0 +1,39 @@ +import { render } from '@testing-library/vue'; +import userEvent from '@testing-library/user-event'; +import N8nTooltip from '../Tooltip.vue'; + +describe('components', () => { + describe('N8nTooltip', () => { + it('should work correctly', async () => { + const buttonSpy = vi.fn(); + + const { getByText } = render(N8nTooltip, { + props: { + teleported: false, + buttons: [ + { + attrs: { + label: 'Button 1', + }, + listeners: { + onClick: buttonSpy, + }, + }, + ], + }, + slots: { + default: 'Wrapped content', + content: 'Tooltip content', + }, + }); + expect(getByText('Wrapped content')).toBeVisible(); + expect(getByText('Tooltip content')).not.toBeVisible(); + + await userEvent.hover(getByText('Wrapped content')); + expect(getByText('Tooltip content')).toBeVisible(); + + await userEvent.click(getByText('Button 1')); + expect(buttonSpy).toHaveBeenCalled(); + }); + }); +}); diff --git a/packages/editor-ui/src/components/ParameterInputFull.vue b/packages/editor-ui/src/components/ParameterInputFull.vue index 53a04f79d5..85ad5b9408 100644 --- a/packages/editor-ui/src/components/ParameterInputFull.vue +++ b/packages/editor-ui/src/components/ParameterInputFull.vue @@ -169,7 +169,7 @@ export default defineComponent({ 'data-test-id': 'dismiss-mapping-tooltip', }, listeners: { - click: mappingTooltipDismissHandler, + onClick: mappingTooltipDismissHandler, }, }, ];