From c98019fc58cb938c0d836a859433d3a2ee291f1c Mon Sep 17 00:00:00 2001 From: Material Web Team Date: Wed, 20 Jul 2022 10:33:28 -0700 Subject: [PATCH] refactor(checkbox): remove need for helper methods in unit tests PiperOrigin-RevId: 462175907 --- checkbox/md-checkbox_test.ts | 51 ++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/checkbox/md-checkbox_test.ts b/checkbox/md-checkbox_test.ts index db27397ae1..f49d8ab8ab 100644 --- a/checkbox/md-checkbox_test.ts +++ b/checkbox/md-checkbox_test.ts @@ -11,29 +11,6 @@ import {html} from 'lit'; import {MdCheckbox} from './checkbox'; import {CheckboxHarness} from './harness'; -interface CheckboxProps { - checked: boolean; - indeterminate: boolean; - disabled: boolean; - value: string; - name: string; - reduceTouchTarget: boolean; -} - -const defaultCheckbox = html``; - -const checkbox = (propsInit: Partial) => { - return html` - - - `; -}; - describe('md-checkbox', () => { let fixt: TestFixture; let element: MdCheckbox; @@ -45,7 +22,7 @@ describe('md-checkbox', () => { describe('basic', () => { beforeEach(async () => { - fixt = await fixture(defaultCheckbox); + fixt = await fixture(html``); element = fixt.root.querySelector('md-checkbox')!; harness = new CheckboxHarness(element); }); @@ -92,7 +69,11 @@ describe('md-checkbox', () => { describe('checked', () => { beforeEach(async () => { - fixt = await fixture(checkbox({checked: true})); + fixt = await fixture(html` + + + `); element = fixt.root.querySelector('md-checkbox')!; harness = new CheckboxHarness(element); await element.updateComplete; @@ -109,7 +90,11 @@ describe('md-checkbox', () => { describe('indeterminate', () => { beforeEach(async () => { - fixt = await fixture(checkbox({indeterminate: true})); + fixt = await fixture(html` + + + `); element = fixt.root.querySelector('md-checkbox')!; harness = new CheckboxHarness(element); await element.updateComplete; @@ -132,7 +117,11 @@ describe('md-checkbox', () => { describe('disabled', () => { beforeEach(async () => { - fixt = await fixture(checkbox({disabled: true})); + fixt = await fixture(html` + + + `); element = fixt.root.querySelector('md-checkbox')!; harness = new CheckboxHarness(element); await element.updateComplete; @@ -151,7 +140,11 @@ describe('md-checkbox', () => { describe('value', () => { beforeEach(async () => { - fixt = await fixture(checkbox({value: 'new value'})); + fixt = await fixture(html` + + + `); element = fixt.root.querySelector('md-checkbox')!; harness = new CheckboxHarness(element); await element.updateComplete; @@ -171,7 +164,7 @@ describe('md-checkbox', () => { let focusRing: MdFocusRing; beforeEach(async () => { - fixt = await fixture(defaultCheckbox); + fixt = await fixture(html``); element = fixt.root.querySelector('md-checkbox')!; focusRing = element.shadowRoot!.querySelector('md-focus-ring')!; harness = new CheckboxHarness(element);