Skip to content

Commit b9ee368

Browse files
amysortommalerba
authored andcommitted
fix(material/schematics): replace all-component-themes mixin with MDC equivalent instead of adding each component's theme
1 parent ff3a61d commit b9ee368

23 files changed

+23
-962
lines changed

src/material/schematics/ng-generate/mdc-migration/rules/components/autocomplete/autocomplete-styles.spec.ts

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -71,70 +71,6 @@ describe('autocomplete styles', () => {
7171
);
7272
});
7373

74-
it('should add correct theme if all-component-themes mixin included', async () => {
75-
await runMigrationTest(
76-
`
77-
@use '@angular/material' as mat;
78-
$theme: ();
79-
@include mat.all-component-themes($theme);
80-
`,
81-
`
82-
@use '@angular/material' as mat;
83-
$theme: ();
84-
@include mat.all-component-themes($theme);
85-
@include mat.mdc-select-theme($theme);
86-
@include mat.mdc-select-typography($theme);
87-
@include mat.mdc-core-theme($theme);
88-
@include mat.mdc-core-typography($theme);
89-
@include mat.mdc-input-theme($theme);
90-
@include mat.mdc-input-typography($theme);
91-
@include mat.mdc-form-field-theme($theme);
92-
@include mat.mdc-form-field-typography($theme);
93-
@include mat.mdc-autocomplete-theme($theme);
94-
@include mat.mdc-autocomplete-typography($theme);
95-
`,
96-
);
97-
});
98-
99-
it('should add multiple themes for multiple all-component-themes mixins', async () => {
100-
await runMigrationTest(
101-
`
102-
@use '@angular/material' as mat;
103-
$light-theme: ();
104-
$dark-theme: ();
105-
@include mat.all-component-themes($light-theme);
106-
@include mat.all-component-themes($dark-theme);
107-
`,
108-
`
109-
@use '@angular/material' as mat;
110-
$light-theme: ();
111-
$dark-theme: ();
112-
@include mat.all-component-themes($light-theme);
113-
@include mat.mdc-select-theme($light-theme);
114-
@include mat.mdc-select-typography($light-theme);
115-
@include mat.mdc-core-theme($light-theme);
116-
@include mat.mdc-core-typography($light-theme);
117-
@include mat.mdc-input-theme($light-theme);
118-
@include mat.mdc-input-typography($light-theme);
119-
@include mat.mdc-form-field-theme($light-theme);
120-
@include mat.mdc-form-field-typography($light-theme);
121-
@include mat.mdc-autocomplete-theme($light-theme);
122-
@include mat.mdc-autocomplete-typography($light-theme);
123-
@include mat.all-component-themes($dark-theme);
124-
@include mat.mdc-select-theme($dark-theme);
125-
@include mat.mdc-select-typography($dark-theme);
126-
@include mat.mdc-core-theme($dark-theme);
127-
@include mat.mdc-core-typography($dark-theme);
128-
@include mat.mdc-input-theme($dark-theme);
129-
@include mat.mdc-input-typography($dark-theme);
130-
@include mat.mdc-form-field-theme($dark-theme);
131-
@include mat.mdc-form-field-typography($dark-theme);
132-
@include mat.mdc-autocomplete-theme($dark-theme);
133-
@include mat.mdc-autocomplete-typography($dark-theme);
134-
`,
135-
);
136-
});
137-
13874
it('should preserve whitespace', async () => {
13975
await runMigrationTest(
14076
`

src/material/schematics/ng-generate/mdc-migration/rules/components/button/button-styles.spec.ts

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -87,58 +87,6 @@ describe('button styles', () => {
8787
);
8888
});
8989

90-
it('should add correct theme if all-component-themes mixin included', async () => {
91-
await runMigrationTest(
92-
`
93-
@use '@angular/material' as mat;
94-
$theme: ();
95-
@include mat.all-component-themes($theme);
96-
`,
97-
`
98-
@use '@angular/material' as mat;
99-
$theme: ();
100-
@include mat.all-component-themes($theme);
101-
@include mat.mdc-button-theme($theme);
102-
@include mat.mdc-button-typography($theme);
103-
@include mat.mdc-fab-theme($theme);
104-
@include mat.mdc-fab-typography($theme);
105-
@include mat.mdc-icon-button-theme($theme);
106-
@include mat.mdc-icon-button-typography($theme);
107-
`,
108-
);
109-
});
110-
111-
it('should add multiple themes for multiple all-component-themes mixins', async () => {
112-
await runMigrationTest(
113-
`
114-
@use '@angular/material' as mat;
115-
$light-theme: ();
116-
$dark-theme: ();
117-
@include mat.all-component-themes($light-theme);
118-
@include mat.all-component-themes($dark-theme);
119-
`,
120-
`
121-
@use '@angular/material' as mat;
122-
$light-theme: ();
123-
$dark-theme: ();
124-
@include mat.all-component-themes($light-theme);
125-
@include mat.mdc-button-theme($light-theme);
126-
@include mat.mdc-button-typography($light-theme);
127-
@include mat.mdc-fab-theme($light-theme);
128-
@include mat.mdc-fab-typography($light-theme);
129-
@include mat.mdc-icon-button-theme($light-theme);
130-
@include mat.mdc-icon-button-typography($light-theme);
131-
@include mat.all-component-themes($dark-theme);
132-
@include mat.mdc-button-theme($dark-theme);
133-
@include mat.mdc-button-typography($dark-theme);
134-
@include mat.mdc-fab-theme($dark-theme);
135-
@include mat.mdc-fab-typography($dark-theme);
136-
@include mat.mdc-icon-button-theme($dark-theme);
137-
@include mat.mdc-icon-button-typography($dark-theme);
138-
`,
139-
);
140-
});
141-
14290
it('should preserve whitespace', async () => {
14391
await runMigrationTest(
14492
`

src/material/schematics/ng-generate/mdc-migration/rules/components/card/card-styles.spec.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,46 +71,6 @@ describe('card styles', () => {
7171
);
7272
});
7373

74-
it('should add correct theme if all-component-themes mixin included', async () => {
75-
await runMigrationTest(
76-
`
77-
@use '@angular/material' as mat;
78-
$theme: ();
79-
@include mat.all-component-themes($theme);
80-
`,
81-
`
82-
@use '@angular/material' as mat;
83-
$theme: ();
84-
@include mat.all-component-themes($theme);
85-
@include mat.mdc-card-theme($theme);
86-
@include mat.mdc-card-typography($theme);
87-
`,
88-
);
89-
});
90-
91-
it('should add multiple themes for multiple all-component-themes mixins', async () => {
92-
await runMigrationTest(
93-
`
94-
@use '@angular/material' as mat;
95-
$light-theme: ();
96-
$dark-theme: ();
97-
@include mat.all-component-themes($light-theme);
98-
@include mat.all-component-themes($dark-theme);
99-
`,
100-
`
101-
@use '@angular/material' as mat;
102-
$light-theme: ();
103-
$dark-theme: ();
104-
@include mat.all-component-themes($light-theme);
105-
@include mat.mdc-card-theme($light-theme);
106-
@include mat.mdc-card-typography($light-theme);
107-
@include mat.all-component-themes($dark-theme);
108-
@include mat.mdc-card-theme($dark-theme);
109-
@include mat.mdc-card-typography($dark-theme);
110-
`,
111-
);
112-
});
113-
11474
it('should preserve whitespace', async () => {
11575
await runMigrationTest(
11676
`

src/material/schematics/ng-generate/mdc-migration/rules/components/checkbox/checkbox-styles.spec.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,46 +71,6 @@ describe('checkbox styles', () => {
7171
);
7272
});
7373

74-
it('should add correct theme if all-component-themes mixin included', async () => {
75-
await runMigrationTest(
76-
`
77-
@use '@angular/material' as mat;
78-
$theme: ();
79-
@include mat.all-component-themes($theme);
80-
`,
81-
`
82-
@use '@angular/material' as mat;
83-
$theme: ();
84-
@include mat.all-component-themes($theme);
85-
@include mat.mdc-checkbox-theme($theme);
86-
@include mat.mdc-checkbox-typography($theme);
87-
`,
88-
);
89-
});
90-
91-
it('should add multiple themes for multiple all-component-themes mixins', async () => {
92-
await runMigrationTest(
93-
`
94-
@use '@angular/material' as mat;
95-
$light-theme: ();
96-
$dark-theme: ();
97-
@include mat.all-component-themes($light-theme);
98-
@include mat.all-component-themes($dark-theme);
99-
`,
100-
`
101-
@use '@angular/material' as mat;
102-
$light-theme: ();
103-
$dark-theme: ();
104-
@include mat.all-component-themes($light-theme);
105-
@include mat.mdc-checkbox-theme($light-theme);
106-
@include mat.mdc-checkbox-typography($light-theme);
107-
@include mat.all-component-themes($dark-theme);
108-
@include mat.mdc-checkbox-theme($dark-theme);
109-
@include mat.mdc-checkbox-typography($dark-theme);
110-
`,
111-
);
112-
});
113-
11474
it('should preserve whitespace', async () => {
11575
await runMigrationTest(
11676
`

src/material/schematics/ng-generate/mdc-migration/rules/components/chips/chips-styles.spec.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,46 +71,6 @@ describe('chips styles', () => {
7171
);
7272
});
7373

74-
it('should add correct theme if all-component-themes mixin included', async () => {
75-
await runMigrationTest(
76-
`
77-
@use '@angular/material' as mat;
78-
$theme: ();
79-
@include mat.all-component-themes($theme);
80-
`,
81-
`
82-
@use '@angular/material' as mat;
83-
$theme: ();
84-
@include mat.all-component-themes($theme);
85-
@include mat.mdc-chips-theme($theme);
86-
@include mat.mdc-chips-typography($theme);
87-
`,
88-
);
89-
});
90-
91-
it('should add multiple themes for multiple all-component-themes mixins', async () => {
92-
await runMigrationTest(
93-
`
94-
@use '@angular/material' as mat;
95-
$light-theme: ();
96-
$dark-theme: ();
97-
@include mat.all-component-themes($light-theme);
98-
@include mat.all-component-themes($dark-theme);
99-
`,
100-
`
101-
@use '@angular/material' as mat;
102-
$light-theme: ();
103-
$dark-theme: ();
104-
@include mat.all-component-themes($light-theme);
105-
@include mat.mdc-chips-theme($light-theme);
106-
@include mat.mdc-chips-typography($light-theme);
107-
@include mat.all-component-themes($dark-theme);
108-
@include mat.mdc-chips-theme($dark-theme);
109-
@include mat.mdc-chips-typography($dark-theme);
110-
`,
111-
);
112-
});
113-
11474
it('should preserve whitespace', async () => {
11575
await runMigrationTest(
11676
`

src/material/schematics/ng-generate/mdc-migration/rules/components/dialog/dialog-styles.spec.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,46 +71,6 @@ describe('dialog styles', () => {
7171
);
7272
});
7373

74-
it('should add correct theme if all-component-themes mixin included', async () => {
75-
await runMigrationTest(
76-
`
77-
@use '@angular/material' as mat;
78-
$theme: ();
79-
@include mat.all-component-themes($theme);
80-
`,
81-
`
82-
@use '@angular/material' as mat;
83-
$theme: ();
84-
@include mat.all-component-themes($theme);
85-
@include mat.mdc-dialog-theme($theme);
86-
@include mat.mdc-dialog-typography($theme);
87-
`,
88-
);
89-
});
90-
91-
it('should add multiple themes for multiple all-component-themes mixins', async () => {
92-
await runMigrationTest(
93-
`
94-
@use '@angular/material' as mat;
95-
$light-theme: ();
96-
$dark-theme: ();
97-
@include mat.all-component-themes($light-theme);
98-
@include mat.all-component-themes($dark-theme);
99-
`,
100-
`
101-
@use '@angular/material' as mat;
102-
$light-theme: ();
103-
$dark-theme: ();
104-
@include mat.all-component-themes($light-theme);
105-
@include mat.mdc-dialog-theme($light-theme);
106-
@include mat.mdc-dialog-typography($light-theme);
107-
@include mat.all-component-themes($dark-theme);
108-
@include mat.mdc-dialog-theme($dark-theme);
109-
@include mat.mdc-dialog-typography($dark-theme);
110-
`,
111-
);
112-
});
113-
11474
it('should preserve whitespace', async () => {
11575
await runMigrationTest(
11676
`

src/material/schematics/ng-generate/mdc-migration/rules/components/form-field/form-field-styles.spec.ts

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -71,70 +71,6 @@ describe('form-field styles', () => {
7171
);
7272
});
7373

74-
it('should add correct theme if all-component-themes mixin included', async () => {
75-
await runMigrationTest(
76-
`
77-
@use '@angular/material' as mat;
78-
$theme: ();
79-
@include mat.all-component-themes($theme);
80-
`,
81-
`
82-
@use '@angular/material' as mat;
83-
$theme: ();
84-
@include mat.all-component-themes($theme);
85-
@include mat.mdc-select-theme($theme);
86-
@include mat.mdc-select-typography($theme);
87-
@include mat.mdc-core-theme($theme);
88-
@include mat.mdc-core-typography($theme);
89-
@include mat.mdc-input-theme($theme);
90-
@include mat.mdc-input-typography($theme);
91-
@include mat.mdc-form-field-theme($theme);
92-
@include mat.mdc-form-field-typography($theme);
93-
@include mat.mdc-autocomplete-theme($theme);
94-
@include mat.mdc-autocomplete-typography($theme);
95-
`,
96-
);
97-
});
98-
99-
it('should add multiple themes for multiple all-component-themes mixins', async () => {
100-
await runMigrationTest(
101-
`
102-
@use '@angular/material' as mat;
103-
$light-theme: ();
104-
$dark-theme: ();
105-
@include mat.all-component-themes($light-theme);
106-
@include mat.all-component-themes($dark-theme);
107-
`,
108-
`
109-
@use '@angular/material' as mat;
110-
$light-theme: ();
111-
$dark-theme: ();
112-
@include mat.all-component-themes($light-theme);
113-
@include mat.mdc-select-theme($light-theme);
114-
@include mat.mdc-select-typography($light-theme);
115-
@include mat.mdc-core-theme($light-theme);
116-
@include mat.mdc-core-typography($light-theme);
117-
@include mat.mdc-input-theme($light-theme);
118-
@include mat.mdc-input-typography($light-theme);
119-
@include mat.mdc-form-field-theme($light-theme);
120-
@include mat.mdc-form-field-typography($light-theme);
121-
@include mat.mdc-autocomplete-theme($light-theme);
122-
@include mat.mdc-autocomplete-typography($light-theme);
123-
@include mat.all-component-themes($dark-theme);
124-
@include mat.mdc-select-theme($dark-theme);
125-
@include mat.mdc-select-typography($dark-theme);
126-
@include mat.mdc-core-theme($dark-theme);
127-
@include mat.mdc-core-typography($dark-theme);
128-
@include mat.mdc-input-theme($dark-theme);
129-
@include mat.mdc-input-typography($dark-theme);
130-
@include mat.mdc-form-field-theme($dark-theme);
131-
@include mat.mdc-form-field-typography($dark-theme);
132-
@include mat.mdc-autocomplete-theme($dark-theme);
133-
@include mat.mdc-autocomplete-typography($dark-theme);
134-
`,
135-
);
136-
});
137-
13874
it('should preserve whitespace', async () => {
13975
await runMigrationTest(
14076
`

0 commit comments

Comments
 (0)