Skip to content

Commit b88e2ee

Browse files
committed
fix(material/schematics): update typescript symbols in test code
1 parent 69904a0 commit b88e2ee

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

src/material/schematics/ng-update/migrations/legacy-components-v15/constants.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,27 @@ export const COMPONENTS = [
3131
'tooltip',
3232
];
3333

34-
export const MAT_IMPORT_CHANGES = COMPONENTS.map(component => ({
35-
old: `@angular/material/${component}`,
36-
new: `@angular/material/legacy-${component}`,
37-
}));
34+
export const MAT_IMPORT_CHANGES = COMPONENTS.flatMap(component => [
35+
{
36+
old: `@angular/material/${component}`,
37+
new: `@angular/material/legacy-${component}`,
38+
},
39+
{
40+
old: `@angular/material/${component}/testing`,
41+
new: `@angular/material/legacy-${component}/testing`,
42+
},
43+
]);
3844

39-
export const MDC_IMPORT_CHANGES = COMPONENTS.map(component => ({
40-
old: `@angular/material-experimental/mdc-${component}`,
41-
new: `@angular/material/${component}`,
42-
}));
45+
export const MDC_IMPORT_CHANGES = COMPONENTS.flatMap(component => [
46+
{
47+
old: `@angular/material-experimental/mdc-${component}`,
48+
new: `@angular/material/${component}`,
49+
},
50+
{
51+
old: `@angular/material-experimental/mdc-${component}/testing`,
52+
new: `@angular/material/${component}/testing`,
53+
},
54+
]);
4355

4456
export const CUSTOM_TS_SYMBOL_RENAMINGS = [
4557
{old: 'getMatAutocompleteMissingPanelError', new: 'getMatLegacyAutocompleteMissingPanelError'},

src/material/schematics/ng-update/test-cases/v15/legacy-components-v15.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ describe('v15 legacy components migration', () => {
8888
old: `import {ProgressBarMode as MatProgressBarMode} from '@angular/material/progress-bar';`,
8989
new: `import {LegacyProgressBarMode as MatProgressBarMode} from '@angular/material/legacy-progress-bar';`,
9090
});
91+
await runTypeScriptMigrationTest('test code', {
92+
old: `import {MatButtonHarness, ButtonHarnessFilters} from '@angular/material/button/testing';`,
93+
new: `import {MatLegacyButtonHarness as MatButtonHarness, LegacyButtonHarnessFilters as ButtonHarnessFilters} from '@angular/material/legacy-button/testing';`,
94+
});
9195
});
9296

9397
it('updates import expressions', async () => {
@@ -139,6 +143,10 @@ describe('v15 legacy components migration', () => {
139143
old: `import {MatButton, MatButtonModule as ButtonModule} from '@angular/material-experimental/mdc-button';`,
140144
new: `import {MatButton, MatButtonModule as ButtonModule} from '@angular/material/button';`,
141145
});
146+
await runTypeScriptMigrationTest('test code', {
147+
old: `import {MatButtonHarness, ButtonHarnessFilters} from '@angular/material-experimental/mdc-button/testing';`,
148+
new: `import {MatButtonHarness, ButtonHarnessFilters} from '@angular/material/button/testing';`,
149+
});
142150
});
143151

144152
it('updates import expressions', async () => {

0 commit comments

Comments
 (0)