@@ -882,7 +882,7 @@ describe('MatCheckbox', () => {
882882 let inputElement : HTMLInputElement ;
883883 let ngModel : NgModel ;
884884
885- beforeEach ( ( ) => {
885+ beforeEach ( fakeAsync ( ( ) => {
886886 fixture = createComponent ( CheckboxWithNgModel ) ;
887887
888888 fixture . componentInstance . isRequired = false ;
@@ -893,7 +893,7 @@ describe('MatCheckbox', () => {
893893 checkboxInstance = checkboxDebugElement . componentInstance ;
894894 inputElement = < HTMLInputElement > checkboxNativeElement . querySelector ( 'input' ) ;
895895 ngModel = checkboxDebugElement . injector . get < NgModel > ( NgModel ) ;
896- } ) ;
896+ } ) ) ;
897897
898898 it ( 'should be pristine, untouched, and valid initially' , ( ) => {
899899 expect ( ngModel . valid ) . toBe ( true ) ;
@@ -967,6 +967,18 @@ describe('MatCheckbox', () => {
967967 expect ( checkboxInstance . checked ) . toBe ( false ) ;
968968 expect ( ngModel . valid ) . toBe ( false ) ;
969969 } ) ;
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+
970982 } ) ;
971983
972984 describe ( 'with name attribute' , ( ) => {
0 commit comments