Skip to content

Commit

Permalink
6. Fix any remaining CI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Aug 15, 2022
1 parent 87c0e40 commit b63f32b
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 50 deletions.
3 changes: 1 addition & 2 deletions integration/mdc-migration/golden/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ $sample-project-theme: mat.define-light-theme((
@include mat.slide-toggle-typography($sample-project-theme);
@include mat.mdc-slider-theme($sample-project-theme);
@include mat.mdc-slider-typography($sample-project-theme);
@include mat.mdc-snack-bar-theme($sample-project-theme);
@include mat.mdc-snack-bar-typography($sample-project-theme);
@include mat.snack-bar-typography($sample-project-theme);
@include mat.mdc-table-theme($sample-project-theme);
@include mat.mdc-table-typography($sample-project-theme);
@include mat.tabs-theme($sample-project-theme);
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-core/theming/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ sass_library(
"//src/material/progress-bar:progress_bar_scss_lib",
"//src/material/slide-toggle:slide_toggle_scss_lib",
"//src/material/slider:slider_scss_lib",
"//src/material/tabs:tabs_scss_lib",
"//src/material/snack-bar:snack_bar_scss_lib",
"//src/material/tabs:tabs_scss_lib",
"//src/material/tooltip:tooltip_scss_lib",
],
)
Expand Down
1 change: 1 addition & 0 deletions src/material/core/theming/tests/theming-api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ describe('theming api', () => {
if (missingDensitySelectors.size === knownDensitySelectors.size) {
return 'none';
}
console.error('MISSING!!! ', [...missingDensitySelectors].join(','));
return 'partial';
}

Expand Down
2 changes: 1 addition & 1 deletion src/material/legacy-snack-bar/_snack-bar-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
`,
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
`,
);
});
Expand All @@ -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);
`,
);
});
Expand All @@ -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);
`,
);
});
Expand All @@ -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);
`,
);
});
Expand All @@ -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);
`,
);
});
Expand All @@ -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);
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 3 additions & 2 deletions src/material/snack-bar/_snack-bar-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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((
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 10 additions & 1 deletion tools/postcss/compare-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Node, Declaration, Rule} from 'postcss';
import {Node, Declaration, Rule, Comment} from 'postcss';

/**
* Compares two Postcss AST nodes and returns whether a boolean indicating
Expand All @@ -19,6 +19,10 @@ export function compareNodes(a: Node, b: Node): boolean {
return false;
}

if (isComment(a) && isComment(b)) {
return a.text === b.text;
}

// Types of A and B are always equal, but for type inferring we
// check both nodes again.
if (isDeclaration(a) && isDeclaration(b)) {
Expand Down Expand Up @@ -54,3 +58,8 @@ function isDeclaration(node: Node): node is Declaration {
function isRule(node: Node): node is Rule {
return node.type === 'rule';
}

/** Asserts that a node is a `Comment`. */
function isComment(node: Node): node is Comment {
return node.type === 'comment';
}

0 comments on commit b63f32b

Please sign in to comment.