|
| 1 | +import { fixtureSync } from '@vaadin/testing-helpers'; |
| 2 | +import { visualDiff } from '@web/test-runner-visual-regression'; |
| 3 | +import '../common.js'; |
| 4 | +import '@vaadin/aura/aura.css'; |
| 5 | +import '../../../vaadin-checkbox.js'; |
| 6 | + |
| 7 | +describe('checkbox', () => { |
| 8 | + let div, element; |
| 9 | + |
| 10 | + beforeEach(() => { |
| 11 | + div = document.createElement('div'); |
| 12 | + div.style.display = 'inline-block'; |
| 13 | + div.style.padding = '10px'; |
| 14 | + element = fixtureSync('<vaadin-checkbox label="Checkbox"></vaadin-checkbox>', div); |
| 15 | + }); |
| 16 | + |
| 17 | + describe('states', () => { |
| 18 | + it('basic', async () => { |
| 19 | + await visualDiff(div, 'basic'); |
| 20 | + }); |
| 21 | + |
| 22 | + it('checked', async () => { |
| 23 | + element.checked = true; |
| 24 | + await visualDiff(div, 'checked'); |
| 25 | + }); |
| 26 | + |
| 27 | + it('indeterminate', async () => { |
| 28 | + element.indeterminate = true; |
| 29 | + await visualDiff(div, 'indeterminate'); |
| 30 | + }); |
| 31 | + |
| 32 | + it('checked', async () => { |
| 33 | + element.setAttribute('active', ''); |
| 34 | + await visualDiff(div, 'active'); |
| 35 | + }); |
| 36 | + |
| 37 | + describe('disabled', () => { |
| 38 | + beforeEach(() => { |
| 39 | + element.disabled = true; |
| 40 | + }); |
| 41 | + |
| 42 | + it('basic', async () => { |
| 43 | + await visualDiff(div, 'disabled'); |
| 44 | + }); |
| 45 | + |
| 46 | + it('checked', async () => { |
| 47 | + element.checked = true; |
| 48 | + await visualDiff(div, 'disabled-checked'); |
| 49 | + }); |
| 50 | + |
| 51 | + it('indeterminate', async () => { |
| 52 | + element.indeterminate = true; |
| 53 | + await visualDiff(div, 'disabled-indeterminate'); |
| 54 | + }); |
| 55 | + }); |
| 56 | + |
| 57 | + describe('readonly', () => { |
| 58 | + beforeEach(() => { |
| 59 | + element.readonly = true; |
| 60 | + }); |
| 61 | + |
| 62 | + it('basic', async () => { |
| 63 | + await visualDiff(div, 'readonly'); |
| 64 | + }); |
| 65 | + |
| 66 | + it('checked', async () => { |
| 67 | + element.checked = true; |
| 68 | + await visualDiff(div, 'readonly-checked'); |
| 69 | + }); |
| 70 | + |
| 71 | + it('indeterminate', async () => { |
| 72 | + element.indeterminate = true; |
| 73 | + await visualDiff(div, 'readonly-indeterminate'); |
| 74 | + }); |
| 75 | + }); |
| 76 | + }); |
| 77 | +}); |
0 commit comments