-
-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix form controls entering / leaving a form (#1708)
* fix dynamic form controls * update comment * add form.checkValidity() * prettier
- Loading branch information
1 parent
f015dc9
commit 5221419
Showing
3 changed files
with
90 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import '../../../dist/shoelace.js'; | ||
|
||
import { expect, fixture, html } from '@open-wc/testing'; | ||
|
||
// Reproduction of this issue: https://github.com/shoelace-style/shoelace/issues/1703 | ||
it('Should still run form validations if an element is removed', async () => { | ||
const form = await fixture<HTMLFormElement>(html` | ||
<form> | ||
<sl-input name="name" label="Name" required></sl-input> | ||
<sl-textarea name="comment" label="Comment" required></sl-textarea> | ||
</form> | ||
`); | ||
|
||
expect(form.checkValidity()).to.equal(false); | ||
expect(form.reportValidity()).to.equal(false); | ||
|
||
form.querySelector('sl-input')!.remove(); | ||
|
||
expect(form.checkValidity()).to.equal(false); | ||
expect(form.reportValidity()).to.equal(false); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters