11import { ComponentFixture , TestBed } from '@angular/core/testing' ;
22import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed' ;
3- import { MatLegacyCheckboxHarness } from '@angular/material/legacy- checkbox/testing' ;
3+ import { MatCheckboxHarness } from '@angular/material/checkbox/testing' ;
44import { HarnessLoader } from '@angular/cdk/testing' ;
55import { ReactiveFormsModule } from '@angular/forms' ;
6- import { MatLegacyCheckboxModule } from '@angular/material/legacy- checkbox' ;
6+ import { MatCheckboxModule } from '@angular/material/checkbox' ;
77import { CheckboxHarnessExample } from './checkbox-harness-example' ;
88
99describe ( 'CheckboxHarnessExample' , ( ) => {
@@ -12,7 +12,7 @@ describe('CheckboxHarnessExample', () => {
1212
1313 beforeEach ( async ( ) => {
1414 await TestBed . configureTestingModule ( {
15- imports : [ MatLegacyCheckboxModule , ReactiveFormsModule ] ,
15+ imports : [ MatCheckboxModule , ReactiveFormsModule ] ,
1616 declarations : [ CheckboxHarnessExample ] ,
1717 } ) . compileComponents ( ) ;
1818 fixture = TestBed . createComponent ( CheckboxHarnessExample ) ;
@@ -21,37 +21,31 @@ describe('CheckboxHarnessExample', () => {
2121 } ) ;
2222
2323 it ( 'should load checkbox with name' , async ( ) => {
24- const checkboxes = await loader . getAllHarnesses (
25- MatLegacyCheckboxHarness . with ( { name : 'first-name' } ) ,
26- ) ;
24+ const checkboxes = await loader . getAllHarnesses ( MatCheckboxHarness . with ( { name : 'first-name' } ) ) ;
2725 expect ( checkboxes . length ) . toBe ( 1 ) ;
2826 expect ( await checkboxes [ 0 ] . getLabelText ( ) ) . toBe ( 'First' ) ;
2927 } ) ;
3028
3129 it ( 'should get checked state' , async ( ) => {
32- const [ checkedCheckbox , uncheckedCheckbox ] = await loader . getAllHarnesses (
33- MatLegacyCheckboxHarness ,
34- ) ;
30+ const [ checkedCheckbox , uncheckedCheckbox ] = await loader . getAllHarnesses ( MatCheckboxHarness ) ;
3531 expect ( await checkedCheckbox . isChecked ( ) ) . toBe ( true ) ;
3632 expect ( await uncheckedCheckbox . isChecked ( ) ) . toBe ( false ) ;
3733 } ) ;
3834
3935 it ( 'should get name' , async ( ) => {
40- const checkbox = await loader . getHarness ( MatLegacyCheckboxHarness . with ( { label : 'First' } ) ) ;
36+ const checkbox = await loader . getHarness ( MatCheckboxHarness . with ( { label : 'First' } ) ) ;
4137 expect ( await checkbox . getName ( ) ) . toBe ( 'first-name' ) ;
4238 } ) ;
4339
4440 it ( 'should get label text' , async ( ) => {
45- const [ firstCheckbox , secondCheckbox ] = await loader . getAllHarnesses ( MatLegacyCheckboxHarness ) ;
41+ const [ firstCheckbox , secondCheckbox ] = await loader . getAllHarnesses ( MatCheckboxHarness ) ;
4642 expect ( await firstCheckbox . getLabelText ( ) ) . toBe ( 'First' ) ;
4743 expect ( await secondCheckbox . getLabelText ( ) ) . toBe ( 'Second' ) ;
4844 } ) ;
4945
5046 it ( 'should toggle checkbox' , async ( ) => {
5147 fixture . componentInstance . disabled = false ;
52- const [ checkedCheckbox , uncheckedCheckbox ] = await loader . getAllHarnesses (
53- MatLegacyCheckboxHarness ,
54- ) ;
48+ const [ checkedCheckbox , uncheckedCheckbox ] = await loader . getAllHarnesses ( MatCheckboxHarness ) ;
5549 await checkedCheckbox . toggle ( ) ;
5650 await uncheckedCheckbox . toggle ( ) ;
5751 expect ( await checkedCheckbox . isChecked ( ) ) . toBe ( false ) ;
0 commit comments