Skip to content

build: add check for new theming bundle #22398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/material/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Theming APIs
@forward './core/theming/theming' show define-light-theme, define-dark-theme,
define-palette, get-contrast-color-from-palette, get-color-from-palette;
define-palette, get-contrast-color-from-palette, get-color-from-palette,
$theme-ignore-duplication-warnings;
@forward './core/theming/palette' show $red-palette, $pink-palette, $indigo-palette,
$purple-palette, $deep-purple-palette, $blue-palette, $light-blue-palette, $cyan-palette,
$teal-palette, $green-palette, $light-green-palette, $lime-palette, $yellow-palette,
Expand Down
12 changes: 10 additions & 2 deletions src/material/core/theming/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ sass_binary(
deps = ["//src/material/core:theming_scss_lib"],
)

# Sass binary which is used to ensure that the theming bundle exposes the necessary
# mixins and variables for creating themes.
# Sass binary used to ensure that the theming bundle works as expected.
sass_binary(
name = "test-theming-bundle",
testonly = True,
src = "test-theming-bundle.scss",
deps = ["//src/material:theming_bundle"],
)

# Sass binary which is used to ensure that the legacy theming bundle exposes the necessary
# mixins and variables for creating themes.
sass_binary(
name = "test-legacy-theming-bundle",
testonly = True,
src = "test-legacy-theming-bundle.scss",
deps = ["//src/material:theming_bundle"],
)

ts_library(
name = "unit_test_lib",
testonly = True,
Expand Down
28 changes: 28 additions & 0 deletions src/material/core/theming/tests/test-legacy-theming-bundle.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Imports the theming bundle. Needs to be an absolute bin-dir import path as on Windows,
// runfiles are not symlinked, so the Sass compilation happens in the workspace directory
// with the include paths being set to the `bazel-bin` directory.
// stylelint-disable-next-line material/no-import
@import 'src/material/theming';

// Disable theme style duplication warnings. This test intentionally generates
// the same themes multiple times.
$mat-theme-ignore-duplication-warnings: true;

@include mat-core();

$theme: mat-light-theme((
color: (
primary: $mat-red,
accent: $mat-blue,
),
density: -2,
));

// If one of these mixins is not available, the compilation will fail and the
// test will be reported as failing.
@include angular-material-theme($theme);
@include angular-material-typography();
@include angular-material-color($theme);
@include angular-material-density($theme);
@include mat-core-theme($theme);
@include mat-button-theme($theme);
24 changes: 11 additions & 13 deletions src/material/core/theming/tests/test-theming-bundle.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
// Imports the theming bundle. Needs to be an absolute bin-dir import path as on Windows,
// runfiles are not symlinked, so the Sass compilation happens in the workspace directory
// with the include paths being set to the `bazel-bin` directory.
// stylelint-disable-next-line material/no-import
@import 'src/material/theming';
@use 'src/material' as mat;

// Disable theme style duplication warnings. This test intentionally generates
// the same themes multiple times.
$mat-theme-ignore-duplication-warnings: true;
mat.$theme-ignore-duplication-warnings: true;

@include mat-core();
@include mat.core();

$theme: mat-light-theme((
$theme: mat.define-light-theme((
color: (
primary: $mat-red,
accent: $mat-blue,
primary: mat.$red-palette,
accent: mat.$blue-palette,
),
density: -2,
));

// If one of these mixins is not available, the compilation will fail and the
// test will be reported as failing.
@include angular-material-theme($theme);
@include angular-material-typography();
@include angular-material-color($theme);
@include angular-material-density($theme);
@include mat-core-theme($theme);
@include mat-button-theme($theme);
@include mat.all-component-themes($theme);
@include mat.all-component-typographies();
@include mat.all-component-colors($theme);
@include mat.core-theme($theme);
@include mat.button-theme($theme);