@@ -2,16 +2,13 @@ import {ComponentHarness, HarnessLoader, parallel} from '@angular/cdk/testing';
2
2
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed' ;
3
3
import { Component } from '@angular/core' ;
4
4
import { ComponentFixture , TestBed } from '@angular/core/testing' ;
5
- import { MatLegacyCardModule } from '@angular/material/legacy-card' ;
6
- import {
7
- MatLegacyCardHarness ,
8
- MatLegacyCardSection ,
9
- } from '@angular/material/legacy-card/testing/card-harness' ;
5
+ import { MatCardModule } from '@angular/material/card' ;
6
+ import { MatCardHarness , MatCardSection } from '@angular/material/card/testing' ;
10
7
11
8
/** Shared tests to run on both the original and MDC-based cards. */
12
9
export function runHarnessTests (
13
- cardModule : typeof MatLegacyCardModule ,
14
- cardHarness : typeof MatLegacyCardHarness ,
10
+ cardModule : typeof MatCardModule ,
11
+ cardHarness : typeof MatCardHarness ,
15
12
contentSelectors : { header : string ; content : string ; actions : string ; footer : string } ,
16
13
) {
17
14
let fixture : ComponentFixture < CardHarnessTest > ;
@@ -73,32 +70,28 @@ export function runHarnessTests(
73
70
74
71
it ( 'should get a harness loader for the card header' , async ( ) => {
75
72
const card = await loader . getHarness ( cardHarness . with ( { title : 'Shiba Inu' } ) ) ;
76
- const headerLoader = await card . getChildLoader ( contentSelectors . header as MatLegacyCardSection ) ;
73
+ const headerLoader = await card . getChildLoader ( contentSelectors . header as MatCardSection ) ;
77
74
const headerSubcomponents = ( await headerLoader ?. getAllHarnesses ( DummyHarness ) ) ?? [ ] ;
78
75
expect ( headerSubcomponents . length ) . toBe ( 2 ) ;
79
76
} ) ;
80
77
81
78
it ( 'should get a harness loader for the card content' , async ( ) => {
82
79
const card = await loader . getHarness ( cardHarness . with ( { title : 'Shiba Inu' } ) ) ;
83
- const contentLoader = await card . getChildLoader (
84
- contentSelectors . content as MatLegacyCardSection ,
85
- ) ;
80
+ const contentLoader = await card . getChildLoader ( contentSelectors . content as MatCardSection ) ;
86
81
const contentSubcomponents = ( await contentLoader ?. getAllHarnesses ( DummyHarness ) ) ?? [ ] ;
87
82
expect ( contentSubcomponents . length ) . toBe ( 1 ) ;
88
83
} ) ;
89
84
90
85
it ( 'should get a harness loader for the card actions' , async ( ) => {
91
86
const card = await loader . getHarness ( cardHarness . with ( { title : 'Shiba Inu' } ) ) ;
92
- const actionLoader = await card . getChildLoader (
93
- contentSelectors . actions as MatLegacyCardSection ,
94
- ) ;
87
+ const actionLoader = await card . getChildLoader ( contentSelectors . actions as MatCardSection ) ;
95
88
const actionSubcomponents = ( await actionLoader ?. getAllHarnesses ( DummyHarness ) ) ?? [ ] ;
96
89
expect ( actionSubcomponents . length ) . toBe ( 2 ) ;
97
90
} ) ;
98
91
99
92
it ( 'should get a harness loader for the card footer' , async ( ) => {
100
93
const card = await loader . getHarness ( cardHarness . with ( { title : 'Shiba Inu' } ) ) ;
101
- const footerLoader = await card . getChildLoader ( contentSelectors . footer as MatLegacyCardSection ) ;
94
+ const footerLoader = await card . getChildLoader ( contentSelectors . footer as MatCardSection ) ;
102
95
const footerSubcomponents = ( await footerLoader ?. getAllHarnesses ( DummyHarness ) ) ?? [ ] ;
103
96
expect ( footerSubcomponents . length ) . toBe ( 1 ) ;
104
97
} ) ;
0 commit comments