@@ -53,6 +53,10 @@ describe('MdInput', function () {
5353 MdInputWithMin ,
5454 MdInputWithStep ,
5555 MdInputWithTabindex ,
56+ MdInputDateTestController ,
57+ MdInputTextTestController ,
58+ MdInputPasswordTestController ,
59+ MdInputNumberTestController ,
5660 ] ,
5761 } ) ;
5862
@@ -70,60 +74,52 @@ describe('MdInput', function () {
7074 if ( isInternetExplorer11 ( ) ) {
7175 return ;
7276 }
73- builder . createAsync ( MdInputDateTestController )
74- . then ( fixture => {
75- fixture . componentInstance . placeholder = 'Placeholder' ;
76- fixture . detectChanges ( ) ;
77-
78- let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
79- expect ( el ) . not . toBeNull ( ) ;
80- expect ( el . className . includes ( 'md-empty' ) ) . toBe ( false ) ;
81- } ) ;
77+ let fixture = TestBed . createComponent ( MdInputDateTestController ) ;
78+ fixture . componentInstance . placeholder = 'Placeholder' ;
79+ fixture . detectChanges ( ) ;
80+
81+ let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
82+ expect ( el ) . not . toBeNull ( ) ;
83+ expect ( el . className . includes ( 'md-empty' ) ) . toBe ( false ) ;
8284 } ) ) ;
8385
8486 it ( 'should treat text input type as empty at init' , async ( ( ) => {
8587 if ( isInternetExplorer11 ( ) ) {
8688 return ;
8789 }
88- builder . createAsync ( MdInputTextTestController )
89- . then ( fixture => {
90- fixture . componentInstance . placeholder = 'Placeholder' ;
91- fixture . detectChanges ( ) ;
92-
93- let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
94- expect ( el ) . not . toBeNull ( ) ;
95- expect ( el . className . includes ( 'md-empty' ) ) . toBe ( true ) ;
96- } ) ;
90+ let fixture = TestBed . createComponent ( MdInputTextTestController ) ;
91+ fixture . componentInstance . placeholder = 'Placeholder' ;
92+ fixture . detectChanges ( ) ;
93+
94+ let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
95+ expect ( el ) . not . toBeNull ( ) ;
96+ expect ( el . className . includes ( 'md-empty' ) ) . toBe ( true ) ;
9797 } ) ) ;
9898
9999 it ( 'should treat password input type as empty at init' , async ( ( ) => {
100100 if ( isInternetExplorer11 ( ) ) {
101101 return ;
102102 }
103- builder . createAsync ( MdInputPasswordTestController )
104- . then ( fixture => {
105- fixture . componentInstance . placeholder = 'Placeholder' ;
106- fixture . detectChanges ( ) ;
107-
108- let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
109- expect ( el ) . not . toBeNull ( ) ;
110- expect ( el . className . includes ( 'md-empty' ) ) . toBe ( true ) ;
111- } ) ;
103+ let fixture = TestBed . createComponent ( MdInputPasswordTestController ) ;
104+ fixture . componentInstance . placeholder = 'Placeholder' ;
105+ fixture . detectChanges ( ) ;
106+
107+ let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
108+ expect ( el ) . not . toBeNull ( ) ;
109+ expect ( el . className . includes ( 'md-empty' ) ) . toBe ( true ) ;
112110 } ) ) ;
113111
114112 it ( 'should treat number input type as empty at init' , async ( ( ) => {
115113 if ( isInternetExplorer11 ( ) ) {
116114 return ;
117115 }
118- builder . createAsync ( MdInputNumberTestController )
119- . then ( fixture => {
120- fixture . componentInstance . placeholder = 'Placeholder' ;
121- fixture . detectChanges ( ) ;
122-
123- let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
124- expect ( el ) . not . toBeNull ( ) ;
125- expect ( el . className . includes ( 'md-empty' ) ) . toBe ( true ) ;
126- } ) ;
116+ let fixture = TestBed . createComponent ( MdInputNumberTestController ) ;
117+ fixture . componentInstance . placeholder = 'Placeholder' ;
118+ fixture . detectChanges ( ) ;
119+
120+ let el = fixture . debugElement . query ( By . css ( 'label' ) ) . nativeElement ;
121+ expect ( el ) . not . toBeNull ( ) ;
122+ expect ( el . className . includes ( 'md-empty' ) ) . toBe ( true ) ;
127123 } ) ) ;
128124
129125 // TODO(kara): update when core/testing adds fix
@@ -765,38 +761,22 @@ class MdInputWithStep { }
765761@Component ( { template : `<md-input [tabindex]="tabIndex"></md-input>` } )
766762class MdInputWithTabindex { }
767763
768- @Component ( {
769- selector : 'test-input-controller' ,
770- template : `
771- <md-input type="date" [placeholder]="placeholder"></md-input>
772- ` ,
773- directives : [ MdInput ]
774- } )
775- class MdInputDateTestController { }
764+ @Component ( { template : `<md-input type="date" [placeholder]="placeholder"></md-input>` } )
765+ class MdInputDateTestController {
766+ placeholder : string = '' ;
767+ }
776768
777- @Component ( {
778- selector : 'test-input-controller' ,
779- template : `
780- <md-input type="text" [placeholder]="placeholder"></md-input>
781- ` ,
782- directives : [ MdInput ]
783- } )
784- class MdInputTextTestController { }
769+ @Component ( { template : `<md-input type="text" [placeholder]="placeholder"></md-input>` } )
770+ class MdInputTextTestController {
771+ placeholder : string = '' ;
772+ }
785773
786- @Component ( {
787- selector : 'test-input-controller' ,
788- template : `
789- <md-input type="password" [placeholder]="placeholder"></md-input>
790- ` ,
791- directives : [ MdInput ]
792- } )
793- class MdInputPasswordTestController { }
774+ @Component ( { template : `<md-input type="password" [placeholder]="placeholder"></md-input>` } )
775+ class MdInputPasswordTestController {
776+ placeholder : string = '' ;
777+ }
794778
795- @Component ( {
796- selector : 'test-input-controller' ,
797- template : `
798- <md-input type="number" [placeholder]="placeholder"></md-input>
799- ` ,
800- directives : [ MdInput ]
801- } )
802- class MdInputNumberTestController { }
779+ @Component ( { template : `<md-input type="number" [placeholder]="placeholder"></md-input>` } )
780+ class MdInputNumberTestController {
781+ placeholder : string = '' ;
782+ }
0 commit comments