@@ -950,7 +950,7 @@ describe('MatCheckbox', () => {
950
950
let inputElement : HTMLInputElement ;
951
951
let ngModel : NgModel ;
952
952
953
- beforeEach ( ( ) => {
953
+ beforeEach ( fakeAsync ( ( ) => {
954
954
fixture = createComponent ( CheckboxWithNgModel ) ;
955
955
956
956
fixture . componentInstance . isRequired = false ;
@@ -961,7 +961,7 @@ describe('MatCheckbox', () => {
961
961
checkboxInstance = checkboxDebugElement . componentInstance ;
962
962
inputElement = < HTMLInputElement > checkboxNativeElement . querySelector ( 'input' ) ;
963
963
ngModel = checkboxDebugElement . injector . get < NgModel > ( NgModel ) ;
964
- } ) ;
964
+ } ) ) ;
965
965
966
966
it ( 'should be pristine, untouched, and valid initially' , ( ) => {
967
967
expect ( ngModel . valid ) . toBe ( true ) ;
@@ -1059,6 +1059,17 @@ describe('MatCheckbox', () => {
1059
1059
expect ( checkboxInstance . checked ) . toBe ( false ) ;
1060
1060
expect ( ngModel . valid ) . toBe ( false ) ;
1061
1061
} ) ;
1062
+
1063
+ it ( 'should update the ngModel value when using the `toggle` method' , fakeAsync ( ( ) => {
1064
+ const checkbox = fixture . debugElement . query ( By . directive ( MatCheckbox ) ) . componentInstance ;
1065
+
1066
+ expect ( fixture . componentInstance . isGood ) . toBe ( false ) ;
1067
+
1068
+ checkbox . toggle ( ) ;
1069
+ fixture . detectChanges ( ) ;
1070
+
1071
+ expect ( fixture . componentInstance . isGood ) . toBe ( true ) ;
1072
+ } ) ) ;
1062
1073
} ) ;
1063
1074
1064
1075
describe ( 'with name attribute' , ( ) => {
0 commit comments