diff --git a/field/test/field_test.ts b/field/lib/field_test.ts similarity index 93% rename from field/test/field_test.ts rename to field/lib/field_test.ts index 1a05a969d2..d5071bed50 100644 --- a/field/test/field_test.ts +++ b/field/lib/field_test.ts @@ -7,7 +7,6 @@ import 'jasmine'; import {Environment} from '@material/web/testing/environment'; -import {State, TemplateBuilder, TemplateProps} from '@material/web/testing/templates'; import {html} from 'lit'; import {customElement} from 'lit/decorators'; @@ -59,29 +58,21 @@ class TestField extends Field { describe('Field', () => { const env = new Environment(); - const templates = - new TemplateBuilder().withHarness(FieldHarness).withVariants({ - field(directive, props) { - return html` - - - - `; - }, - }); - - async function setupTest(props: TemplateProps = {}) { + async function setupTest(props: Partial = {}) { // Variant type does not matter for shared tests - const template = templates.variant('field', props).render(State.DEFAULT); - const instance = - template ? env.render(template).querySelector('md-test-field') : null; + const template = html` + + + + `; + const root = env.render(template); + const instance = root.querySelector('md-test-field'); if (!instance) { throw new Error('Could not query rendered .'); } diff --git a/field/test/filled-field_test.ts b/field/lib/filled-field_test.ts similarity index 83% rename from field/test/filled-field_test.ts rename to field/lib/filled-field_test.ts index 9cfce7ab6b..c2f0031cef 100644 --- a/field/test/filled-field_test.ts +++ b/field/lib/filled-field_test.ts @@ -7,7 +7,6 @@ import 'jasmine'; import {Environment} from '@material/web/testing/environment'; -import {State, TemplateBuilder, TemplateProps} from '@material/web/testing/templates'; import {html} from 'lit'; import {customElement} from 'lit/decorators'; @@ -54,30 +53,21 @@ describe('Field', () => { describe('', () => { const env = new Environment(); - const templates = - new TemplateBuilder().withHarness(FieldHarness).withVariants({ - filled(directive, props) { - return html` - - - - `; - }, - }); - - async function setupTest(props: TemplateProps = {}) { + async function setupTest(props: Partial = {}) { // Variant type does not matter for shared tests - const template = templates.variant('filled', props).render(State.DEFAULT); - const instance = template ? - env.render(template).querySelector('md-test-filled-field') : - null; + const template = html` + + + + `; + const root = env.render(template); + const instance = root.querySelector('md-test-filled-field'); if (!instance) { throw new Error('Could not query rendered .'); } diff --git a/field/test/outlined-field_test.ts b/field/lib/outlined-field_test.ts similarity index 67% rename from field/test/outlined-field_test.ts rename to field/lib/outlined-field_test.ts index 46e5755102..3d6110d8a9 100644 --- a/field/test/outlined-field_test.ts +++ b/field/lib/outlined-field_test.ts @@ -7,7 +7,6 @@ import 'jasmine'; import {Environment} from '@material/web/testing/environment'; -import {State, TemplateBuilder, TemplateProps} from '@material/web/testing/templates'; import {html} from 'lit'; import {customElement} from 'lit/decorators'; @@ -39,31 +38,21 @@ describe('Field', () => { describe('', () => { const env = new Environment(); - const templates = - new TemplateBuilder().withHarness(FieldHarness).withVariants({ - outlined(directive, props) { - return html` - - - - `; - }, - }); - - async function setupTest(props: TemplateProps = {}) { + async function setupTest(props: Partial = {}) { // Variant type does not matter for shared tests - const template = - templates.variant('outlined', props).render(State.DEFAULT); - const instance = template ? - env.render(template).querySelector('md-test-outlined-field') : - null; + const template = html` + + + + `; + const root = env.render(template); + const instance = root.querySelector('md-test-outlined-field'); if (!instance) { throw new Error('Could not query rendered .'); }