Skip to content

Commit

Permalink
test: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 23, 2024
1 parent ab76c71 commit 212dac1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/browser/fixtures/user-event/clipboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { expect, test } from 'vitest';
import { page, userEvent, server } from '@vitest/browser/context';

test('clipboard', async () => {
// make it smaller since webdriverio fails when scaled
page.viewport(300, 300)

document.body.innerHTML = `
<input placeholder="first" />
<input placeholder="second" />
Expand Down Expand Up @@ -31,16 +34,16 @@ test('clipboard', async () => {
await userEvent.keyboard(paste);
await userEvent.keyboard(paste);

// cut first "hello"
// append first "world" and cut
await userEvent.click(page.getByPlaceholder('first'));
await userEvent.keyboard('world');
await userEvent.keyboard(`{selectall}`);
await userEvent.keyboard(cut);

// paste it to third
await userEvent.click(page.getByPlaceholder('third'));
await userEvent.keyboard(paste);

// hellohello
expect([
(page.getByPlaceholder('first').element() as any).value,
(page.getByPlaceholder('second').element() as any).value,
Expand All @@ -49,7 +52,7 @@ test('clipboard', async () => {
[
"",
"hellohello",
"hello",
"helloworld",
]
`)
});

0 comments on commit 212dac1

Please sign in to comment.