File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
src/material/schematics/ng-update/test-cases Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments