Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: reset keyboardActive between tests #8504

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/combo-box/test/visual/lumo/combo-box.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import { fixtureSync, mousedown, nextFrame } from '@vaadin/testing-helpers';
import { sendKeys } from '@web/test-runner-commands';
import { visualDiff } from '@web/test-runner-visual-regression';
import '../common.js';
Expand All @@ -15,6 +15,13 @@ describe('combo-box', () => {
element = fixtureSync('<vaadin-combo-box></vaadin-combo-box>', div);
});

afterEach(() => {
// After tests which use sendKeys() the focus-utils.js -> isKeyboardActive is set to true.
// Click once here on body to reset it so other tests are not affected by it.
// An unwanted focus-ring would be shown in other tests otherwise.
mousedown(document.body);
});

it('basic', async () => {
await visualDiff(div, 'basic');
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion packages/date-picker/test/visual/lumo/date-picker.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fixtureSync } from '@vaadin/testing-helpers/dist/fixture.js';
import { fixtureSync, mousedown } from '@vaadin/testing-helpers';
import { sendKeys } from '@web/test-runner-commands';
import { visualDiff } from '@web/test-runner-visual-regression';
import '../../../theme/lumo/vaadin-date-picker.js';
Expand All @@ -15,6 +15,13 @@ describe('date-picker', () => {
element = fixtureSync('<vaadin-date-picker></vaadin-date-picker>', div);
});

afterEach(() => {
// After tests which use sendKeys() the focus-utils.js -> isKeyboardActive is set to true.
// Click once here on body to reset it so other tests are not affected by it.
// An unwanted focus-ring would be shown in other tests otherwise.
mousedown(document.body);
});

it('basic', async () => {
await visualDiff(div, 'basic');
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions packages/time-picker/test/visual/lumo/time-picker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ describe('time-picker', () => {
element.style.setProperty('--vaadin-time-picker-overlay-max-height', '300px');
});

afterEach(() => {
// After tests which use sendKeys() the focus-utils.js -> isKeyboardActive is set to true.
// Click once here on body to reset it so other tests are not affected by it.
// An unwanted focus-ring would be shown in other tests otherwise.
mousedown(document.body);
});

it('basic', async () => {
await visualDiff(div, 'basic');
});
Expand All @@ -23,11 +30,6 @@ describe('time-picker', () => {
await sendKeys({ press: 'Tab' });

await visualDiff(div, 'focus-ring');

// at this moment focus-utils.js -> isKeyboardActive is true.
// Click once here to reset it so other tests are not affected by it.
// A focus-ring would be shown in other tests otherwise.
mousedown(document.body);
});

it('disabled', async () => {
Expand Down