-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add snapshot tests for checkbox (#3517)
- Loading branch information
1 parent
feabe44
commit 4746f91
Showing
3 changed files
with
100 additions
and
19 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
71 changes: 71 additions & 0 deletions
71
packages/checkbox/test/dom/__snapshots__/checkbox.test.snap.js
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,71 @@ | ||
/* @web/test-runner snapshot v1 */ | ||
export const snapshots = {}; | ||
|
||
snapshots["vaadin-checkbox host default"] = | ||
`<vaadin-checkbox | ||
has-label="" | ||
has-value="" | ||
label="I accept terms and conditions" | ||
> | ||
<label | ||
for="vaadin-checkbox-0" | ||
id="label-vaadin-checkbox-0" | ||
slot="label" | ||
> | ||
I accept terms and conditions | ||
</label> | ||
<input | ||
id="vaadin-checkbox-0" | ||
slot="input" | ||
type="checkbox" | ||
value="on" | ||
> | ||
</vaadin-checkbox> | ||
`; | ||
/* end snapshot vaadin-checkbox host default */ | ||
|
||
snapshots["vaadin-checkbox host disabled"] = | ||
`<vaadin-checkbox | ||
aria-disabled="true" | ||
disabled="" | ||
has-label="" | ||
has-value="" | ||
label="I accept terms and conditions" | ||
> | ||
<label | ||
for="vaadin-checkbox-1" | ||
id="label-vaadin-checkbox-1" | ||
slot="label" | ||
> | ||
I accept terms and conditions | ||
</label> | ||
<input | ||
disabled="" | ||
id="vaadin-checkbox-1" | ||
slot="input" | ||
tabindex="-1" | ||
type="checkbox" | ||
value="on" | ||
> | ||
</vaadin-checkbox> | ||
`; | ||
/* end snapshot vaadin-checkbox host disabled */ | ||
|
||
snapshots["vaadin-checkbox shadow default"] = | ||
`<div class="vaadin-checkbox-container"> | ||
<div class="vaadin-checkbox-wrapper"> | ||
<div part="checkbox"> | ||
</div> | ||
<slot name="input"> | ||
</slot> | ||
</div> | ||
<slot name="label"> | ||
</slot> | ||
<div style="display: none !important"> | ||
<slot id="noop"> | ||
</slot> | ||
</div> | ||
</div> | ||
`; | ||
/* end snapshot vaadin-checkbox shadow default */ | ||
|
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,28 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import { fixtureSync } from '@vaadin/testing-helpers'; | ||
import '../../vaadin-checkbox.js'; | ||
|
||
describe('vaadin-checkbox', () => { | ||
let checkbox; | ||
|
||
beforeEach(() => { | ||
checkbox = fixtureSync('<vaadin-checkbox label="I accept terms and conditions"></vaadin-checkbox>'); | ||
}); | ||
|
||
describe('host', () => { | ||
it('default', async () => { | ||
await expect(checkbox).dom.to.equalSnapshot(); | ||
}); | ||
|
||
it('disabled', async () => { | ||
checkbox.disabled = true; | ||
await expect(checkbox).dom.to.equalSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('shadow', () => { | ||
it('default', async () => { | ||
await expect(checkbox).shadowDom.to.equalSnapshot(); | ||
}); | ||
}); | ||
}); |