fix(editor): Do not show mapping discoverability tooltip after dismiss (#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
This commit is contained in:
Csaba Tuncsik 2023-08-07 20:16:01 +02:00 committed by GitHub
parent efe08cced3
commit 08982ede4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 4 deletions

View file

@ -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();

View file

@ -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'),
},
},
],

View file

@ -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();
});
});
});

View file

@ -169,7 +169,7 @@ export default defineComponent({
'data-test-id': 'dismiss-mapping-tooltip',
},
listeners: {
click: mappingTooltipDismissHandler,
onClick: mappingTooltipDismissHandler,
},
},
];