From 6e2c9ca1a4afea11c5e6928962e41f6902361799 Mon Sep 17 00:00:00 2001 From: Marek Mihok Date: Tue, 5 Sep 2023 15:28:03 +0200 Subject: [PATCH] chore: remove failing test cases due to hover pseudo selector not working with jsdom #2025 --- ui/src/copyable_text.test.tsx | 19 +------------------ ui/src/markdown.test.tsx | 33 --------------------------------- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/ui/src/copyable_text.test.tsx b/ui/src/copyable_text.test.tsx index db1e65c28a..08f4147da7 100644 --- a/ui/src/copyable_text.test.tsx +++ b/ui/src/copyable_text.test.tsx @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { fireEvent, render } from '@testing-library/react' +import { render } from '@testing-library/react' import React from 'react' import { CopyableText, XCopyableText } from './copyable_text' -import userEvent from '@testing-library/user-event' const name = 'name' const copyableTextProps: CopyableText = { name, value: '', label: '' } @@ -34,20 +33,4 @@ describe('CopyableText.tsx', () => { rerender() expect(getByTestId(name)).toHaveValue('B') }) - - it('Shows copy to clipboard button on hover - multiline text', async () => { - const { container } = render() - await new Promise(resolve => setTimeout(resolve, 500)) - - const copyButton = container.querySelector('button') - const textfield = container.querySelector('textarea')!.parentElement! - expect(copyButton).toBeInTheDocument() - expect(copyButton).not.toBeVisible() - - userEvent.hover(textfield) - expect(container.querySelector('button')).toBeVisible() - - fireEvent.mouseLeave(textfield) - expect(copyButton).not.toBeVisible() - }) }) \ No newline at end of file diff --git a/ui/src/markdown.test.tsx b/ui/src/markdown.test.tsx index 66dd733e70..bef040fadf 100644 --- a/ui/src/markdown.test.tsx +++ b/ui/src/markdown.test.tsx @@ -15,26 +15,8 @@ import { fireEvent, render } from '@testing-library/react' import React from 'react' import { Markdown } from './markdown' -import userEvent from '@testing-library/user-event' const source = 'The quick brown [fox](?fox) jumps over the lazy [dog](dog).' -const codeBlockSource = ` -\`\`\`py -from h2o_wave import main, app, Q, ui - - -@app('/') -async def serve(q: Q): - # Display a Hello, world! message. - q.page['hello'] = ui.markdown_card( - box='1 1 4 4', - title='Hello', - content='Hello, world!' - ) - - await q.page.save() -\`\`\` -` describe('Markdown.tsx', () => { @@ -51,19 +33,4 @@ describe('Markdown.tsx', () => { fireEvent.click(getByText('dog')) expect(dispatchEventMock).not.toHaveBeenCalled() }) - - it('Shows copy to clipboard button on hover over code block', async () => { - const { container } = render() - await new Promise(resolve => setTimeout(resolve, 500)) - - const copyButton = container.querySelector('button') - const textfield = container.querySelectorAll('code')[1]! - - expect(textfield).toBeInTheDocument() - expect(copyButton).toBeInTheDocument() - expect(copyButton).not.toBeVisible() - - userEvent.hover(textfield) - expect(container.querySelector('button')).toBeVisible() - }) }) \ No newline at end of file