Skip to content

Commit b00eb3f

Browse files
committed
fix(material/schematics): add schematic to rename tokens
1 parent 9d7e856 commit b00eb3f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import {UnitTestTree} from '@angular-devkit/schematics/testing';
2+
import {createTestCaseSetup} from '@angular/cdk/schematics/testing';
3+
import {MIGRATION_PATH} from '../../paths';
4+
5+
const THEME_FILE_PATH = '/projects/cdk-testing/src/theme.scss';
6+
7+
describe('v20 rename tokens migration', () => {
8+
let tree: UnitTestTree;
9+
let writeFile: (filename: string, content: string) => void;
10+
let runMigration: () => Promise<unknown>;
11+
12+
function stripWhitespace(content: string): string {
13+
return content.replace(/\s/g, '');
14+
}
15+
16+
beforeEach(async () => {
17+
const testSetup = await createTestCaseSetup('migration-v20', MIGRATION_PATH, []);
18+
tree = testSetup.appTree;
19+
writeFile = testSetup.writeFile;
20+
runMigration = testSetup.runFixers;
21+
});
22+
23+
it('should rename mdc tokens to mat', async () => {
24+
writeFile(
25+
THEME_FILE_PATH,
26+
`
27+
html {
28+
--mdc-icon-button-icon-size: 24px;
29+
}
30+
`,
31+
);
32+
33+
await runMigration();
34+
35+
expect(stripWhitespace(tree.readText(THEME_FILE_PATH))).toBe(
36+
stripWhitespace(`
37+
html {
38+
--mat-icon-button-icon-size: 24px;
39+
}
40+
`),
41+
);
42+
});
43+
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy