@@ -104,6 +104,39 @@ describe('MdCheckbox', () => {
104104 expect ( inputElement . indeterminate ) . toBe ( false ) ;
105105 } ) ;
106106
107+ it ( 'should set indeterminate to false when set checked' , ( ) => {
108+ testComponent . isIndeterminate = true ;
109+ fixture . detectChanges ( ) ;
110+
111+ expect ( checkboxInstance . indeterminate ) . toBe ( true ) ;
112+ expect ( inputElement . indeterminate ) . toBe ( true ) ;
113+ expect ( testComponent . isIndeterminate ) . toBe ( true ) ;
114+
115+ testComponent . isChecked = true ;
116+ fixture . detectChanges ( ) ;
117+
118+ expect ( checkboxInstance . checked ) . toBe ( true ) ;
119+ expect ( inputElement . indeterminate ) . toBe ( false ) ;
120+ expect ( inputElement . checked ) . toBe ( true ) ;
121+ expect ( testComponent . isIndeterminate ) . toBe ( false ) ;
122+
123+ testComponent . isIndeterminate = true ;
124+ fixture . detectChanges ( ) ;
125+
126+ expect ( checkboxInstance . indeterminate ) . toBe ( true ) ;
127+ expect ( inputElement . indeterminate ) . toBe ( true ) ;
128+ expect ( inputElement . checked ) . toBe ( true ) ;
129+ expect ( testComponent . isIndeterminate ) . toBe ( true ) ;
130+
131+ testComponent . isChecked = false ;
132+ fixture . detectChanges ( ) ;
133+
134+ expect ( checkboxInstance . checked ) . toBe ( false ) ;
135+ expect ( inputElement . indeterminate ) . toBe ( false ) ;
136+ expect ( inputElement . checked ) . toBe ( false ) ;
137+ expect ( testComponent . isIndeterminate ) . toBe ( false ) ;
138+ } ) ;
139+
107140 it ( 'should change native element checked when check programmatically' , ( ) => {
108141 expect ( inputElement . checked ) . toBe ( false ) ;
109142
@@ -627,7 +660,7 @@ describe('MdCheckbox', () => {
627660 [required]="isRequired"
628661 [labelPosition]="labelPos"
629662 [checked]="isChecked"
630- [indeterminate]="isIndeterminate"
663+ [( indeterminate) ]="isIndeterminate"
631664 [disabled]="isDisabled"
632665 [color]="checkboxColor"
633666 (change)="changeCount = changeCount + 1"
0 commit comments