Skip to content

Commit

Permalink
fix(editor): Do not show mapping discoverability tooltip after dismiss (
Browse files Browse the repository at this point in the history
n8n-io#6862)

* fix(editor): Do not show mapping discoverability tooltip after dismiss

* test: add tooltip design system component test

* fix(editor): no need to dismiss mapping tooltip multiple times
  • Loading branch information
cstuncsik authored Aug 7, 2023
1 parent efe08cc commit 08982ed
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
1 change: 0 additions & 1 deletion cypress/e2e/14-mapping.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TooltipWithButtons.args = {
'data-test-id': 'tooltip-button',
},
listeners: {
click: () => alert('Clicked 1'),
onClick: () => alert('Clicked 1'),
},
},
{
Expand All @@ -68,7 +68,7 @@ TooltipWithButtons.args = {
'data-test-id': 'tooltip-button',
},
listeners: {
click: () => alert('Clicked 2'),
onClick: () => alert('Clicked 2'),
},
},
],
Expand Down
Original file line number Diff line number Diff line change
@@ -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: '<span>Wrapped content</span>',
content: '<span>Tooltip content</span>',
},
});
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();
});
});
});
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/ParameterInputFull.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default defineComponent({
'data-test-id': 'dismiss-mapping-tooltip',
},
listeners: {
click: mappingTooltipDismissHandler,
onClick: mappingTooltipDismissHandler,
},
},
];
Expand Down

0 comments on commit 08982ed

Please sign in to comment.