@@ -882,7 +882,7 @@ describe('MatCheckbox', () => {
882
882
let inputElement : HTMLInputElement ;
883
883
let ngModel : NgModel ;
884
884
885
- beforeEach ( ( ) => {
885
+ beforeEach ( fakeAsync ( ( ) => {
886
886
fixture = createComponent ( CheckboxWithNgModel ) ;
887
887
888
888
fixture . componentInstance . isRequired = false ;
@@ -893,7 +893,7 @@ describe('MatCheckbox', () => {
893
893
checkboxInstance = checkboxDebugElement . componentInstance ;
894
894
inputElement = < HTMLInputElement > checkboxNativeElement . querySelector ( 'input' ) ;
895
895
ngModel = checkboxDebugElement . injector . get < NgModel > ( NgModel ) ;
896
- } ) ;
896
+ } ) ) ;
897
897
898
898
it ( 'should be pristine, untouched, and valid initially' , ( ) => {
899
899
expect ( ngModel . valid ) . toBe ( true ) ;
@@ -967,6 +967,18 @@ describe('MatCheckbox', () => {
967
967
expect ( checkboxInstance . checked ) . toBe ( false ) ;
968
968
expect ( ngModel . valid ) . toBe ( false ) ;
969
969
} ) ;
970
+
971
+ it ( 'should updated the ngModel value when using the `toggle` method' , fakeAsync ( ( ) => {
972
+ const checkbox = fixture . debugElement . query ( By . directive ( MatCheckbox ) ) . componentInstance ;
973
+
974
+ expect ( fixture . componentInstance . isGood ) . toBe ( false ) ;
975
+
976
+ checkbox . toggle ( ) ;
977
+ fixture . detectChanges ( ) ;
978
+
979
+ expect ( fixture . componentInstance . isGood ) . toBe ( true ) ;
980
+ } ) ) ;
981
+
970
982
} ) ;
971
983
972
984
describe ( 'with name attribute' , ( ) => {
0 commit comments