mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
Add test
This commit is contained in:
parent
1a990a70fa
commit
00ad7a9446
|
@ -25,6 +25,7 @@ async function focusEditor(container: Element) {
|
||||||
await waitFor(() => expect(container.querySelector('.cm-line')).toBeInTheDocument());
|
await waitFor(() => expect(container.querySelector('.cm-line')).toBeInTheDocument());
|
||||||
await userEvent.click(container.querySelector('.cm-line') as Element);
|
await userEvent.click(container.querySelector('.cm-line') as Element);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nodes = [
|
const nodes = [
|
||||||
{
|
{
|
||||||
id: '1',
|
id: '1',
|
||||||
|
@ -172,4 +173,23 @@ describe('SqlEditor.vue', () => {
|
||||||
getByTestId(EXPRESSION_OUTPUT_TEST_ID).getElementsByClassName('cm-line').length,
|
getByTestId(EXPRESSION_OUTPUT_TEST_ID).getElementsByClassName('cm-line').length,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should keep rendered output visible when clicking', async () => {
|
||||||
|
const { getByTestId, queryByTestId, container, baseElement } = renderComponent(SqlEditor, {
|
||||||
|
...DEFAULT_SETUP,
|
||||||
|
props: {
|
||||||
|
...DEFAULT_SETUP.props,
|
||||||
|
modelValue: 'SELECT * FROM users',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Does not hide output when clicking inside the output
|
||||||
|
await focusEditor(container);
|
||||||
|
await userEvent.click(getByTestId(EXPRESSION_OUTPUT_TEST_ID));
|
||||||
|
await waitFor(() => expect(queryByTestId(EXPRESSION_OUTPUT_TEST_ID)).toBeInTheDocument());
|
||||||
|
|
||||||
|
// Does hide output when clicking outside the container
|
||||||
|
await userEvent.click(baseElement);
|
||||||
|
await waitFor(() => expect(queryByTestId(EXPRESSION_OUTPUT_TEST_ID)).not.toBeInTheDocument());
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue