-
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-group (#3518)
- Loading branch information
1 parent
4746f91
commit f717293
Showing
3 changed files
with
189 additions
and
8 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
156 changes: 156 additions & 0 deletions
156
packages/checkbox-group/test/dom/__snapshots__/checkbox-group.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,156 @@ | ||
/* @web/test-runner snapshot v1 */ | ||
export const snapshots = {}; | ||
|
||
snapshots["vaadin-checkbox-group host default"] = | ||
`<vaadin-checkbox-group role="group"> | ||
<vaadin-checkbox | ||
has-label="" | ||
has-value="" | ||
label="Checkbox 1" | ||
value="1" | ||
> | ||
<label | ||
for="vaadin-checkbox-0" | ||
id="label-vaadin-checkbox-1" | ||
slot="label" | ||
> | ||
Checkbox 1 | ||
</label> | ||
<input | ||
id="vaadin-checkbox-0" | ||
slot="input" | ||
type="checkbox" | ||
value="1" | ||
> | ||
</vaadin-checkbox> | ||
<vaadin-checkbox | ||
has-label="" | ||
has-value="" | ||
label="Checkbox 2" | ||
value="2" | ||
> | ||
<label | ||
for="vaadin-checkbox-1" | ||
id="label-vaadin-checkbox-2" | ||
slot="label" | ||
> | ||
Checkbox 2 | ||
</label> | ||
<input | ||
id="vaadin-checkbox-1" | ||
slot="input" | ||
type="checkbox" | ||
value="2" | ||
> | ||
</vaadin-checkbox> | ||
<label | ||
id="label-vaadin-checkbox-group-0" | ||
slot="label" | ||
> | ||
</label> | ||
<div | ||
hidden="" | ||
id="error-message-vaadin-checkbox-group-0" | ||
slot="error-message" | ||
> | ||
</div> | ||
</vaadin-checkbox-group> | ||
`; | ||
/* end snapshot vaadin-checkbox-group host default */ | ||
|
||
snapshots["vaadin-checkbox-group host disabled"] = | ||
`<vaadin-checkbox-group | ||
aria-disabled="true" | ||
disabled="" | ||
role="group" | ||
> | ||
<vaadin-checkbox | ||
aria-disabled="true" | ||
disabled="" | ||
has-label="" | ||
has-value="" | ||
label="Checkbox 1" | ||
value="1" | ||
> | ||
<label | ||
for="vaadin-checkbox-2" | ||
id="label-vaadin-checkbox-4" | ||
slot="label" | ||
> | ||
Checkbox 1 | ||
</label> | ||
<input | ||
disabled="" | ||
id="vaadin-checkbox-2" | ||
slot="input" | ||
tabindex="-1" | ||
type="checkbox" | ||
value="1" | ||
> | ||
</vaadin-checkbox> | ||
<vaadin-checkbox | ||
aria-disabled="true" | ||
disabled="" | ||
has-label="" | ||
has-value="" | ||
label="Checkbox 2" | ||
value="2" | ||
> | ||
<label | ||
for="vaadin-checkbox-3" | ||
id="label-vaadin-checkbox-5" | ||
slot="label" | ||
> | ||
Checkbox 2 | ||
</label> | ||
<input | ||
disabled="" | ||
id="vaadin-checkbox-3" | ||
slot="input" | ||
tabindex="-1" | ||
type="checkbox" | ||
value="2" | ||
> | ||
</vaadin-checkbox> | ||
<label | ||
id="label-vaadin-checkbox-group-3" | ||
slot="label" | ||
> | ||
</label> | ||
<div | ||
hidden="" | ||
id="error-message-vaadin-checkbox-group-1" | ||
slot="error-message" | ||
> | ||
</div> | ||
</vaadin-checkbox-group> | ||
`; | ||
/* end snapshot vaadin-checkbox-group host disabled */ | ||
|
||
snapshots["vaadin-checkbox-group shadow default"] = | ||
`<div class="vaadin-group-field-container"> | ||
<div part="label"> | ||
<slot name="label"> | ||
</slot> | ||
<span | ||
aria-hidden="true" | ||
part="required-indicator" | ||
> | ||
</span> | ||
</div> | ||
<div part="group-field"> | ||
<slot> | ||
</slot> | ||
</div> | ||
<div part="helper-text"> | ||
<slot name="helper"> | ||
</slot> | ||
</div> | ||
<div part="error-message"> | ||
<slot name="error-message"> | ||
</slot> | ||
</div> | ||
</div> | ||
`; | ||
/* end snapshot vaadin-checkbox-group 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,33 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import { fixtureSync } from '@vaadin/testing-helpers'; | ||
import '../../vaadin-checkbox-group.js'; | ||
|
||
describe('vaadin-checkbox-group', () => { | ||
let group; | ||
|
||
beforeEach(() => { | ||
group = fixtureSync(` | ||
<vaadin-checkbox-group> | ||
<vaadin-checkbox value="1" label="Checkbox 1"></vaadin-checkbox> | ||
<vaadin-checkbox value="2" label="Checkbox 2"></vaadin-checkbox> | ||
</vaadin-checkbox-group> | ||
`); | ||
}); | ||
|
||
describe('host', () => { | ||
it('default', async () => { | ||
await expect(group).dom.to.equalSnapshot(); | ||
}); | ||
|
||
it('disabled', async () => { | ||
group.disabled = true; | ||
await expect(group).dom.to.equalSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('shadow', () => { | ||
it('default', async () => { | ||
await expect(group).shadowDom.to.equalSnapshot(); | ||
}); | ||
}); | ||
}); |