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: remove not needed await in date-picker dropdown test #8228

Merged
merged 1 commit into from
Nov 25, 2024
Merged
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
23 changes: 1 addition & 22 deletions packages/date-picker/test/dropdown.common.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import { expect } from '@vaadin/chai-plugins';
import {
aTimeout,
fire,
fixtureSync,
mousedown,
nextRender,
nextUpdate,
oneEvent,
touchstart,
} from '@vaadin/testing-helpers';
import { aTimeout, fire, fixtureSync, mousedown, nextRender, oneEvent, touchstart } from '@vaadin/testing-helpers';
import { resetMouse, sendKeys, sendMouse } from '@web/test-runner-commands';
import sinon from 'sinon';
import { getFocusableCell, monthsEqual, open, waitForOverlayRender } from './helpers.js';
Expand All @@ -32,7 +23,6 @@ describe('dropdown', () => {
it('should detach overlay on datePicker detach', async () => {
await open(datePicker);
datePicker.parentElement.removeChild(datePicker);
await nextUpdate(datePicker);
expect(overlay.parentElement).to.not.be.ok;
});

Expand All @@ -55,7 +45,6 @@ describe('dropdown', () => {
await oneEvent(overlay, 'vaadin-overlay-open');

toggleButton.click();
await nextUpdate(datePicker);

expect(datePicker.opened).to.be.false;
expect(overlay.opened).to.be.false;
Expand All @@ -70,7 +59,6 @@ describe('dropdown', () => {
describe('scroll to date', () => {
it('should scroll to today by default', async () => {
datePicker.open();
await nextUpdate(datePicker);

const spy = sinon.spy(datePicker._overlayContent, 'scrollToDate');
await oneEvent(overlay, 'vaadin-overlay-open');
Expand All @@ -84,7 +72,6 @@ describe('dropdown', () => {
datePicker.initialPosition = '2016-01-01';

datePicker.open();
await nextUpdate(datePicker);

const spy = sinon.spy(datePicker._overlayContent, 'scrollToDate');
await oneEvent(overlay, 'vaadin-overlay-open');
Expand All @@ -98,7 +85,6 @@ describe('dropdown', () => {
datePicker.value = '2000-02-01';

datePicker.open();
await nextUpdate(datePicker);

const spy = sinon.spy(datePicker._overlayContent, 'scrollToDate');
await oneEvent(overlay, 'vaadin-overlay-open');
Expand All @@ -122,7 +108,6 @@ describe('dropdown', () => {

it('should scroll to date on reopen', async () => {
datePicker.open();
await nextUpdate(datePicker);

// We must scroll to initial position on reopen because
// scrollTop can be reset while the dropdown is closed.
Expand All @@ -143,7 +128,6 @@ describe('dropdown', () => {
datePicker.min = '2100-01-01';

datePicker.open();
await nextUpdate(datePicker);

const spy = sinon.spy(datePicker._overlayContent, 'scrollToDate');
await oneEvent(overlay, 'vaadin-overlay-open');
Expand All @@ -157,7 +141,6 @@ describe('dropdown', () => {
datePicker.max = '2000-01-01';

datePicker.open();
await nextUpdate(datePicker);

const spy = sinon.spy(datePicker._overlayContent, 'scrollToDate');
await oneEvent(overlay, 'vaadin-overlay-open');
Expand All @@ -174,7 +157,6 @@ describe('dropdown', () => {
datePicker.initialPosition = '2015-01-01';

datePicker.open();
await nextUpdate(datePicker);

const spy = sinon.spy(datePicker._overlayContent, 'scrollToDate');
await oneEvent(overlay, 'vaadin-overlay-open');
Expand Down Expand Up @@ -202,7 +184,6 @@ describe('dropdown', () => {
expect(document.activeElement).to.equal(document.body);
await open(datePicker);
await sendMouse({ type: 'click', position: [200, 10] });
await nextUpdate(datePicker);
await aTimeout(0);
expect(document.activeElement).to.equal(input);
});
Expand All @@ -212,7 +193,6 @@ describe('dropdown', () => {
await sendKeys({ press: 'Tab' });
await open(datePicker);
await sendMouse({ type: 'click', position: [200, 10] });
await nextUpdate(datePicker);
await aTimeout(0);
expect(datePicker.hasAttribute('focus-ring')).to.be.true;
});
Expand Down Expand Up @@ -290,7 +270,6 @@ describe('dropdown', () => {
it('should disable virtual keyboard on close', async () => {
await open(datePicker);
datePicker.close();
await nextUpdate(datePicker);
expect(input.inputMode).to.equal('none');
});

Expand Down