This commit is contained in:
Elias Meire 2024-11-08 12:20:53 +01:00
parent 1a990a70fa
commit 00ad7a9446
No known key found for this signature in database

View file

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