Skip to content

Commit 53933e0

Browse files
committed
test: add theming test for material-experimental package
This test can be moved to the material package once all MDC components have fully moved over. Right now we need to keep it in the experimental package so that we can test the components not being moved over yet. e.g. ensuring MDC snapshot failures are caught, like in the `mdc-list`.
1 parent c5d922b commit 53933e0

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
load("@bazel_skylib//rules:build_test.bzl", "build_test")
2+
load("//tools:defaults.bzl", "sass_binary")
3+
4+
# Sass binary used to ensure that the theming entry-point works as expected.
5+
sass_binary(
6+
name = "test-theming",
7+
testonly = True,
8+
src = "test-theming.scss",
9+
deps = ["//src/material-experimental:sass_lib"],
10+
)
11+
12+
build_test(
13+
name = "test",
14+
targets = [
15+
":test-theming",
16+
],
17+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Imports the theming entry-point. Needs to be an absolute bin-dir import path as on Windows,
2+
// runfiles are not symlinked, so the Sass compilation happens in the workspace directory
3+
// with the include paths being set to the `bazel-bin` directory.
4+
@use 'src/material' as mat;
5+
@use 'src/material-experimental' as experimental;
6+
7+
// Disable theme style duplication warnings. This test intentionally generates
8+
// the same themes multiple times.
9+
mat.$theme-ignore-duplication-warnings: true;
10+
11+
@include mat.core();
12+
13+
$theme: mat.define-light-theme((
14+
color: (
15+
primary: mat.define-palette(mat.$red-palette),
16+
accent: mat.define-palette(mat.$blue-palette),
17+
),
18+
density: null,
19+
));
20+
21+
// If one of these mixins is not available, the compilation will fail and the
22+
// test will be reported as failing.
23+
@include experimental.all-mdc-component-themes($theme);
24+
@include experimental.all-mdc-component-typographies($theme);
25+
@include experimental.all-mdc-component-colors($theme);
26+
27+
@include experimental.all-mdc-component-densities((density: 0));
28+
@include experimental.all-mdc-component-densities((density: -1));
29+
@include experimental.all-mdc-component-densities((density: minimum));
30+
31+
32+
@include mat.strong-focus-indicators();
33+
@include mat.strong-focus-indicators-theme($theme);

0 commit comments

Comments
 (0)