From 3e70e0b6775bd3187d35c8c19155836a618ba8b3 Mon Sep 17 00:00:00 2001 From: Miles Malerba Date: Fri, 12 Aug 2022 19:43:45 +0000 Subject: [PATCH] 6. Fix any remaining CI issues --- .../core/theming/tests/theming-api.spec.ts | 1 + .../density/private/_all-density.scss | 1 + .../legacy-snack-bar/_snack-bar-theme.scss | 2 +- .../multiple-components-styles.spec.ts | 3 +- .../snack-bar/snack-bar-styles.spec.ts | 60 +++++++++---------- .../components/snack-bar/snack-bar-styles.ts | 9 +-- .../ng-generate/mdc-migration/rules/index.ts | 2 +- src/material/snack-bar/_snack-bar-theme.scss | 5 +- 8 files changed, 37 insertions(+), 46 deletions(-) diff --git a/src/material/core/theming/tests/theming-api.spec.ts b/src/material/core/theming/tests/theming-api.spec.ts index a1df9c67e3a6..73b1501dd7c8 100644 --- a/src/material/core/theming/tests/theming-api.spec.ts +++ b/src/material/core/theming/tests/theming-api.spec.ts @@ -232,6 +232,7 @@ describe('theming api', () => { if (missingDensitySelectors.size === knownDensitySelectors.size) { return 'none'; } + console.error('MISSING!!! ', [...missingDensitySelectors].join(',')); return 'partial'; } diff --git a/src/material/legacy-core/density/private/_all-density.scss b/src/material/legacy-core/density/private/_all-density.scss index 8aff6db663ca..668e4e6817fa 100644 --- a/src/material/legacy-core/density/private/_all-density.scss +++ b/src/material/legacy-core/density/private/_all-density.scss @@ -1,6 +1,7 @@ @use '../../../core/theming/theming'; @use '../../../core/density/private/all-density'; @use '../../../legacy-form-field/form-field-theme'; +@use '../../../legacy-button/button-theme'; // Add legacy theme imports here, e.g.: // @use '../../..//-theme'; diff --git a/src/material/legacy-snack-bar/_snack-bar-theme.scss b/src/material/legacy-snack-bar/_snack-bar-theme.scss index fabb1343d932..dfa7dc387cc0 100644 --- a/src/material/legacy-snack-bar/_snack-bar-theme.scss +++ b/src/material/legacy-snack-bar/_snack-bar-theme.scss @@ -48,7 +48,7 @@ @mixin theme($theme-or-color-config) { $theme: theming.private-legacy-get-theme($theme-or-color-config); - @include theming.private-check-duplicate-theme-styles($theme, 'mat-snack-bar') { + @include theming.private-check-duplicate-theme-styles($theme, 'mat-legacy-snack-bar') { $color: theming.get-color-config($theme); $density: theming.get-density-config($theme); $typography: theming.get-typography-config($theme); diff --git a/src/material/schematics/ng-generate/mdc-migration/rules/components/multiple-components-styles.spec.ts b/src/material/schematics/ng-generate/mdc-migration/rules/components/multiple-components-styles.spec.ts index d478fea86331..bc067093152b 100644 --- a/src/material/schematics/ng-generate/mdc-migration/rules/components/multiple-components-styles.spec.ts +++ b/src/material/schematics/ng-generate/mdc-migration/rules/components/multiple-components-styles.spec.ts @@ -60,8 +60,7 @@ describe('multiple component styles', () => { @include mat.mdc-fab-typography($theme); @include mat.mdc-icon-button-theme($theme); @include mat.mdc-icon-button-typography($theme); - @include mat.mdc-snack-bar-theme($theme); - @include mat.mdc-snack-bar-typography($theme); + @include mat.snack-bar-typography($theme); `, ); }); diff --git a/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.spec.ts b/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.spec.ts index accb1372b337..07862ac5effe 100644 --- a/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.spec.ts +++ b/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.spec.ts @@ -17,6 +17,8 @@ describe('snack-bar styles', () => { cliAppTree = patchDevkitTreeToExposeTypeScript(await createTestApp(runner)); }); + // TODO(wagnermaciel): why don't this emit: + // @include mat.snack-bar-theme($theme); describe('mixin migrations', () => { it('should replace the old theme with the new ones', async () => { await runMigrationTest( @@ -28,10 +30,9 @@ describe('snack-bar styles', () => { ` @use '@angular/material' as mat; $theme: (); - @include mat.mdc-snack-bar-theme($theme); - @include mat.mdc-snack-bar-typography($theme); - @include mat.mdc-button-theme($theme); - @include mat.mdc-button-typography($theme); + @include mat.snack-bar-typography($theme); + @include mat.button-theme($theme); + @include mat.button-typography($theme); `, ); }); @@ -41,17 +42,15 @@ describe('snack-bar styles', () => { ` @use '@angular/material' as mat; $theme: (); - @include mat.button-theme($theme); + @include mat.legacy-button-theme($theme); @include mat.legacy-snack-bar-theme($theme); `, ` @use '@angular/material' as mat; $theme: (); - @include mat.button-theme($theme); - @include mat.mdc-snack-bar-theme($theme); - @include mat.mdc-snack-bar-typography($theme); - @include mat.mdc-button-theme($theme); - @include mat.mdc-button-typography($theme); + @include mat.legacy-button-theme($theme); + @include mat.snack-bar-typography($theme); + @include mat.button-typography($theme); `, ); }); @@ -62,16 +61,15 @@ describe('snack-bar styles', () => { @use '@angular/material' as mat; $theme: (); @include mat.legacy-snack-bar-theme($theme); - @include mat.mdc-button-theme($theme); - @include mat.mdc-button-typography($theme); + @include mat.button-theme($theme); + @include mat.button-typography($theme); `, ` @use '@angular/material' as mat; $theme: (); - @include mat.mdc-snack-bar-theme($theme); - @include mat.mdc-snack-bar-typography($theme); - @include mat.mdc-button-theme($theme); - @include mat.mdc-button-typography($theme); + @include mat.snack-bar-typography($theme); + @include mat.button-theme($theme); + @include mat.button-typography($theme); `, ); }); @@ -81,15 +79,14 @@ describe('snack-bar styles', () => { ` @use '@angular/material' as arbitrary; $theme: (); - @include arbitrary.snack-bar-theme($theme); + @include arbitrary.legacy-snack-bar-theme($theme); `, ` @use '@angular/material' as arbitrary; $theme: (); - @include arbitrary.mdc-snack-bar-theme($theme); - @include arbitrary.mdc-snack-bar-typography($theme); - @include arbitrary.mdc-button-theme($theme); - @include arbitrary.mdc-button-typography($theme); + @include arbitrary.snack-bar-typography($theme); + @include arbitrary.button-theme($theme); + @include arbitrary.button-typography($theme); `, ); }); @@ -107,14 +104,12 @@ describe('snack-bar styles', () => { @use '@angular/material' as mat; $light-theme: (); $dark-theme: (); - @include mat.mdc-snack-bar-theme($light-theme); - @include mat.mdc-snack-bar-typography($light-theme); - @include mat.mdc-button-theme($light-theme); - @include mat.mdc-button-typography($light-theme); - @include mat.mdc-snack-bar-theme($dark-theme); - @include mat.mdc-snack-bar-typography($dark-theme); - @include mat.mdc-button-theme($dark-theme); - @include mat.mdc-button-typography($dark-theme); + @include mat.snack-bar-typography($light-theme); + @include mat.button-theme($light-theme); + @include mat.button-typography($light-theme); + @include mat.snack-bar-typography($dark-theme); + @include mat.button-theme($dark-theme); + @include mat.button-typography($dark-theme); `, ); }); @@ -135,10 +130,9 @@ describe('snack-bar styles', () => { $theme: (); - @include mat.mdc-snack-bar-theme($theme); - @include mat.mdc-snack-bar-typography($theme); - @include mat.mdc-button-theme($theme); - @include mat.mdc-button-typography($theme); + @include mat.snack-bar-typography($theme); + @include mat.button-theme($theme); + @include mat.button-typography($theme); `, diff --git a/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.ts b/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.ts index bf5bfb7c08c1..dad04058a015 100644 --- a/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.ts +++ b/src/material/schematics/ng-generate/mdc-migration/rules/components/snack-bar/snack-bar-styles.ts @@ -17,13 +17,8 @@ export class SnackBarMigrator extends StyleMigrator { mixinChanges = [ { - old: 'snack-bar-theme', - new: [ - 'mdc-snack-bar-theme', - 'mdc-snack-bar-typography', - 'mdc-button-theme', - 'mdc-button-typography', - ], + old: 'legacy-snack-bar-theme', + new: ['snack-bar-theme', 'snack-bar-typography', 'button-theme', 'button-typography'], checkForDuplicates: true, }, ]; diff --git a/src/material/schematics/ng-generate/mdc-migration/rules/index.ts b/src/material/schematics/ng-generate/mdc-migration/rules/index.ts index ed8c0b79a64a..3ebc3d2d12ae 100644 --- a/src/material/schematics/ng-generate/mdc-migration/rules/index.ts +++ b/src/material/schematics/ng-generate/mdc-migration/rules/index.ts @@ -29,7 +29,7 @@ import {RuntimeMigrator} from './ts-migration/runtime-migrator'; import {SelectStylesMigrator} from './components/select/select-styles'; import {SlideToggleStylesMigrator} from './components/slide-toggle/slide-toggle-styles'; import {SliderStylesMigrator} from './components/slider/slider-styles'; -import {SnackBarMigrator} from './components/legacy-snack-bar/snack-bar-styles'; +import {SnackBarMigrator} from './components/snack-bar/snack-bar-styles'; import {TableStylesMigrator} from './components/table/table-styles'; import {TabsStylesMigrator} from './components/tabs/tabs-styles'; import {TooltipStylesMigrator} from './components/tooltip/tooltip-styles'; diff --git a/src/material/snack-bar/_snack-bar-theme.scss b/src/material/snack-bar/_snack-bar-theme.scss index ef12e99e0608..cb0e2e1a37ee 100644 --- a/src/material/snack-bar/_snack-bar-theme.scss +++ b/src/material/snack-bar/_snack-bar-theme.scss @@ -15,7 +15,8 @@ @include mdc-helpers.using-mdc-theme($config) { .mat-mdc-snack-bar-container { - $button-color: if($is-dark-theme, currentColor, theming.get-color-from-palette($accent, text)); + $button-color: + if($is-dark-theme, currentColor, theming.get-color-from-palette($accent, text)); --mat-mdc-snack-bar-button-color: #{$button-color}; @include mdc-snackbar-theme.theme(( @@ -54,7 +55,7 @@ @mixin theme($theme-or-color-config) { $theme: theming.private-legacy-get-theme($theme-or-color-config); - @include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-snack-bar') { + @include theming.private-check-duplicate-theme-styles($theme, 'mat-snack-bar') { $color: theming.get-color-config($theme); $density: theming.get-density-config($theme); $typography: theming.get-typography-config($theme);