fix crashing in form.test.ts

This commit is contained in:
konnorrogers
2024-09-18 16:51:57 -04:00
parent 335010cd95
commit 59b7f4de27

View File

@@ -2,13 +2,13 @@ import { aTimeout, expect, waitUntil } from '@open-wc/testing';
import { fixtures } from './test/fixture.js';
import { html } from 'lit';
import sinon from 'sinon';
import { clickOnElement } from './test.js';
describe('Form tests', () => {
for (const fixture of fixtures) {
describe(`with "${fixture.type}" rendering`, () => {
// Reproduction of this issue: https://github.com/shoelace-style/shoelace/issues/1703
it('Should still run form validations if an element is removed', async () => {
await aTimeout(500);
const form = await fixture<HTMLFormElement>(html`
<form>
<wa-input name="name" label="Name" required></wa-input>
@@ -28,6 +28,10 @@ describe('Form tests', () => {
expect(form.checkValidity()).to.equal(false);
expect(form.reportValidity()).to.equal(false);
// This is silly,but it fixes an issue with `reportValidity()` causing WebKit to crash.
await clickOnElement(document.body);
await aTimeout(100);
});
it('should submit the correct form values', async () => {