@@ -104,6 +104,39 @@ describe('MdCheckbox', () => {
104
104
expect ( inputElement . indeterminate ) . toBe ( false ) ;
105
105
} ) ;
106
106
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
+
107
140
it ( 'should change native element checked when check programmatically' , ( ) => {
108
141
expect ( inputElement . checked ) . toBe ( false ) ;
109
142
@@ -627,7 +660,7 @@ describe('MdCheckbox', () => {
627
660
[required]="isRequired"
628
661
[labelPosition]="labelPos"
629
662
[checked]="isChecked"
630
- [indeterminate]="isIndeterminate"
663
+ [( indeterminate) ]="isIndeterminate"
631
664
[disabled]="isDisabled"
632
665
[color]="checkboxColor"
633
666
(change)="changeCount = changeCount + 1"
0 commit comments