diff --git a/src/demo-app/components/dialog-demo/dialog-demo.component.ts b/src/demo-app/components/dialog-demo/dialog-demo.component.ts index a6d749b1f..f71db3a47 100644 --- a/src/demo-app/components/dialog-demo/dialog-demo.component.ts +++ b/src/demo-app/components/dialog-demo/dialog-demo.component.ts @@ -46,13 +46,13 @@ export class DialogDemoComponent { showDialogForm() { // reset error state - this.input.updateErrorState(true); + this.input.setValid(true); this.dialogForm.show(); } updateForm() { // reset error state - this.input.updateErrorState(false); + this.input.setValid(false); if (!this.userForm.valid) { return; } diff --git a/src/demo-app/components/textfield-demo/textfield-demo.component.html b/src/demo-app/components/textfield-demo/textfield-demo.component.html index be1b01f47..da79e199c 100644 --- a/src/demo-app/components/textfield-demo/textfield-demo.component.html +++ b/src/demo-app/components/textfield-demo/textfield-demo.component.html @@ -30,55 +30,55 @@
Comments are required
+ `, +}) +class SimpleTextfield { + username: string = ''; + isDisabled: boolean = false; + isRequired: boolean = false; + isMultiline: boolean = false; +} \ No newline at end of file diff --git a/test/unit/textfield/textfield-box.test.ts b/test/unit/textfield/textfield-box.test.ts new file mode 100644 index 000000000..f2e11d935 --- /dev/null +++ b/test/unit/textfield/textfield-box.test.ts @@ -0,0 +1,76 @@ +import { Component, DebugElement } from '@angular/core'; +import { async, ComponentFixture, fakeAsync, flushMicrotasks, TestBed } from '@angular/core/testing'; +import { FormControl, FormsModule, NgModel, ReactiveFormsModule } from '@angular/forms'; +import { By } from '@angular/platform-browser'; + +import { + MdcTextfieldBoxComponent, + MdcTextfieldInputDirective, + MdcTextfieldModule +} from '../../../src/lib/public_api'; + +describe('MdcTextfieldBoxComponent', () => { + let fixture: ComponentFixtureUsername is required
+ `, +}) +class SimpleTextfield { + boxId: string = 'simple-check'; + username: string = ''; + isDisabled: boolean = false; + isRequired: boolean = false; +} diff --git a/test/unit/textfield/textfield.test.ts b/test/unit/textfield/textfield.test.ts new file mode 100644 index 000000000..99d2788a1 --- /dev/null +++ b/test/unit/textfield/textfield.test.ts @@ -0,0 +1,111 @@ +import { Component, DebugElement } from '@angular/core'; +import { async, ComponentFixture, fakeAsync, flushMicrotasks, TestBed } from '@angular/core/testing'; +import { FormControl, FormsModule, NgModel, ReactiveFormsModule } from '@angular/forms'; +import { By } from '@angular/platform-browser'; + +import { + MdcTextfieldComponent, + MdcTextfieldModule +} from '../../../src/lib/public_api'; + +describe('MdcTextfieldComponent', () => { + let fixture: ComponentFixtureUsername is required
+ `, +}) +class SimpleTextfield { + username: string = ''; + myType: string = 'text'; + isDisabled: boolean = false; + isDense: boolean = false; + isFullwidth: boolean = false; + isRequired: boolean = false; +}