mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
fix(editor): Enable pin data button to also un-pin (#13642)
This commit is contained in:
committed by
GitHub
parent
d9e3cfe13f
commit
24681f843c
@@ -30,7 +30,7 @@ const renderComponent = createComponentRenderer(RunDataPinButton, {
|
||||
},
|
||||
dataPinningDocsUrl: '',
|
||||
pinnedData: {
|
||||
hasData: false,
|
||||
hasData: { value: false },
|
||||
},
|
||||
disabled: false,
|
||||
},
|
||||
@@ -121,4 +121,30 @@ describe('RunDataPinButton.vue', () => {
|
||||
expect(getByRole('tooltip')).toBeVisible();
|
||||
expect(getByRole('tooltip')).toHaveTextContent('disabled');
|
||||
});
|
||||
|
||||
it('pins data on button click', async () => {
|
||||
const { getByTestId, getByRole, emitted } = renderComponent({});
|
||||
// Should show 'Pin data' tooltip and emit togglePinData event
|
||||
await userEvent.hover(getByTestId('ndv-pin-data'));
|
||||
expect(getByRole('tooltip')).toBeVisible();
|
||||
expect(getByRole('tooltip').textContent).toContain('Pin data');
|
||||
await userEvent.click(getByTestId('ndv-pin-data'));
|
||||
expect(emitted().togglePinData).toBeDefined();
|
||||
});
|
||||
|
||||
it('should show correct tooltip and unpin data on button click', async () => {
|
||||
const { getByTestId, getByRole, emitted } = renderComponent({
|
||||
props: {
|
||||
pinnedData: {
|
||||
hasData: { value: true },
|
||||
},
|
||||
},
|
||||
});
|
||||
// Should show 'Unpin data' tooltip and emit togglePinData event
|
||||
await userEvent.hover(getByTestId('ndv-pin-data'));
|
||||
expect(getByRole('tooltip')).toBeVisible();
|
||||
expect(getByRole('tooltip').textContent).toContain('Unpin data');
|
||||
await userEvent.click(getByTestId('ndv-pin-data'));
|
||||
expect(emitted().togglePinData).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user