Skip to content

Commit 59c9d32

Browse files
committed
add mdc theme to tests
1 parent 9e83031 commit 59c9d32

File tree

6 files changed

+110
-1
lines changed

6 files changed

+110
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
4+
5+
sass_library(
6+
name = "all_themes",
7+
srcs = [
8+
"_all-theme.scss",
9+
],
10+
deps = [
11+
"//src/material-experimental/mdc-button:mdc_button_scss_lib",
12+
"//src/material-experimental/mdc-card:mdc_card_scss_lib",
13+
"//src/material-experimental/mdc-checkbox:mdc_checkbox_scss_lib",
14+
"//src/material-experimental/mdc-chips:mdc_chips_scss_lib",
15+
"//src/material-experimental/mdc-menu:mdc_menu_scss_lib",
16+
"//src/material-experimental/mdc-radio:mdc_radio_scss_lib",
17+
"//src/material-experimental/mdc-slide-toggle:mdc_slide_toggle_scss_lib",
18+
"//src/material-experimental/mdc-tabs:mdc_tabs_scss_lib",
19+
],
20+
)
21+
22+
sass_binary(
23+
name = "indigo_pink_prebuilt",
24+
src = "prebuilt/indigo-pink.scss",
25+
include_paths = [
26+
"external/npm/node_modules",
27+
],
28+
deps = [
29+
":all_themes",
30+
"//src/material-experimental/mdc-typography:all_typography",
31+
],
32+
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@import '../mdc-button/mdc-button';
2+
@import '../mdc-card/mdc-card';
3+
@import '../mdc-checkbox/mdc-checkbox';
4+
@import '../mdc-chips/mdc-chips';
5+
@import '../mdc-menu/mdc-menu';
6+
@import '../mdc-radio/mdc-radio';
7+
@import '../mdc-slide-toggle/mdc-slide-toggle';
8+
@import '../mdc-tabs/mdc-tabs';
9+
10+
@mixin angular-material-theme-mdc($theme) {
11+
@include mat-button-theme-mdc($theme);
12+
@include mat-fab-theme-mdc($theme);
13+
@include mat-icon-button-theme-mdc($theme);
14+
@include mat-card-theme-mdc($theme);
15+
@include mat-checkbox-theme-mdc($theme);
16+
@include mat-chips-theme-mdc($theme);
17+
@include mat-menu-theme-mdc($theme);
18+
@include mat-radio-theme-mdc($theme);
19+
@include mat-slide-toggle-theme-mdc($theme);
20+
@include mat-tabs-theme-mdc($theme);
21+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@import '../all-theme';
2+
@import '../../mdc-typography/all-typography';
3+
4+
// Define a theme.
5+
$primary: mat-palette($mat-indigo);
6+
$accent: mat-palette($mat-pink, A200, A100, A400);
7+
8+
$theme: mat-light-theme($primary, $accent);
9+
10+
// Include all theme styles for the components.
11+
@include angular-material-theme-mdc($theme);
12+
@include angular-material-typography-mdc();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@io_bazel_rules_sass//:defs.bzl", "sass_library")
4+
5+
sass_library(
6+
name = "all_typography",
7+
srcs = [
8+
"_all-typography.scss",
9+
],
10+
deps = [
11+
"//src/material-experimental/mdc-button:mdc_button_scss_lib",
12+
"//src/material-experimental/mdc-card:mdc_card_scss_lib",
13+
"//src/material-experimental/mdc-checkbox:mdc_checkbox_scss_lib",
14+
"//src/material-experimental/mdc-chips:mdc_chips_scss_lib",
15+
"//src/material-experimental/mdc-menu:mdc_menu_scss_lib",
16+
"//src/material-experimental/mdc-radio:mdc_radio_scss_lib",
17+
"//src/material-experimental/mdc-slide-toggle:mdc_slide_toggle_scss_lib",
18+
"//src/material-experimental/mdc-tabs:mdc_tabs_scss_lib",
19+
],
20+
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@import '../mdc-button/mdc-button';
2+
@import '../mdc-card/mdc-card';
3+
@import '../mdc-checkbox/mdc-checkbox';
4+
@import '../mdc-chips/mdc-chips';
5+
@import '../mdc-menu/mdc-menu';
6+
@import '../mdc-radio/mdc-radio';
7+
@import '../mdc-slide-toggle/mdc-slide-toggle';
8+
@import '../mdc-tabs/mdc-tabs';
9+
10+
@mixin angular-material-typography-mdc($config: null) {
11+
@include mat-button-typography-mdc($config);
12+
@include mat-fab-typography-mdc($config);
13+
@include mat-icon-button-typography-mdc($config);
14+
@include mat-card-typography-mdc($config);
15+
@include mat-checkbox-typography-mdc($config);
16+
@include mat-chips-typography-mdc($config);
17+
@include mat-menu-typography-mdc($config);
18+
@include mat-radio-typography-mdc($config);
19+
@include mat-slide-toggle-typography-mdc($config);
20+
@include mat-tabs-typography-mdc($config);
21+
}

tools/defaults.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ def ng_web_test_suite(deps = [], static_css = [], bootstrap = [], **kwargs):
127127
# that is needed for measuring, will unexpectedly fail. Also always adding a prebuilt theme
128128
# reduces the amount of setup that is needed to create a test suite Bazel target. Note that the
129129
# prebuilt theme will be also added to CDK test suites but shouldn't affect anything.
130-
static_css = static_css + ["//src/material/prebuilt-themes:indigo-pink"]
130+
static_css = static_css + [
131+
"//src/material/prebuilt-themes:indigo-pink",
132+
"//src/material-experimental/mdc-theming:indigo_pink_prebuilt",
133+
]
131134

132135
# Workaround for https://github.com/bazelbuild/rules_typescript/issues/301
133136
# Since some of our tests depend on CSS files which are not part of the `ng_module` rule,

0 commit comments

Comments
 (0)