Skip to content

Commit

Permalink
add mdc theme to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Jun 20, 2019
1 parent 9e83031 commit 59c9d32
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/material-experimental/mdc-theming/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")

sass_library(
name = "all_themes",
srcs = [
"_all-theme.scss",
],
deps = [
"//src/material-experimental/mdc-button:mdc_button_scss_lib",
"//src/material-experimental/mdc-card:mdc_card_scss_lib",
"//src/material-experimental/mdc-checkbox:mdc_checkbox_scss_lib",
"//src/material-experimental/mdc-chips:mdc_chips_scss_lib",
"//src/material-experimental/mdc-menu:mdc_menu_scss_lib",
"//src/material-experimental/mdc-radio:mdc_radio_scss_lib",
"//src/material-experimental/mdc-slide-toggle:mdc_slide_toggle_scss_lib",
"//src/material-experimental/mdc-tabs:mdc_tabs_scss_lib",
],
)

sass_binary(
name = "indigo_pink_prebuilt",
src = "prebuilt/indigo-pink.scss",
include_paths = [
"external/npm/node_modules",
],
deps = [
":all_themes",
"//src/material-experimental/mdc-typography:all_typography",
],
)
21 changes: 21 additions & 0 deletions src/material-experimental/mdc-theming/_all-theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import '../mdc-button/mdc-button';
@import '../mdc-card/mdc-card';
@import '../mdc-checkbox/mdc-checkbox';
@import '../mdc-chips/mdc-chips';
@import '../mdc-menu/mdc-menu';
@import '../mdc-radio/mdc-radio';
@import '../mdc-slide-toggle/mdc-slide-toggle';
@import '../mdc-tabs/mdc-tabs';

@mixin angular-material-theme-mdc($theme) {
@include mat-button-theme-mdc($theme);
@include mat-fab-theme-mdc($theme);
@include mat-icon-button-theme-mdc($theme);
@include mat-card-theme-mdc($theme);
@include mat-checkbox-theme-mdc($theme);
@include mat-chips-theme-mdc($theme);
@include mat-menu-theme-mdc($theme);
@include mat-radio-theme-mdc($theme);
@include mat-slide-toggle-theme-mdc($theme);
@include mat-tabs-theme-mdc($theme);
}
12 changes: 12 additions & 0 deletions src/material-experimental/mdc-theming/prebuilt/indigo-pink.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@import '../all-theme';
@import '../../mdc-typography/all-typography';

// Define a theme.
$primary: mat-palette($mat-indigo);
$accent: mat-palette($mat-pink, A200, A100, A400);

$theme: mat-light-theme($primary, $accent);

// Include all theme styles for the components.
@include angular-material-theme-mdc($theme);
@include angular-material-typography-mdc();
20 changes: 20 additions & 0 deletions src/material-experimental/mdc-typography/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_sass//:defs.bzl", "sass_library")

sass_library(
name = "all_typography",
srcs = [
"_all-typography.scss",
],
deps = [
"//src/material-experimental/mdc-button:mdc_button_scss_lib",
"//src/material-experimental/mdc-card:mdc_card_scss_lib",
"//src/material-experimental/mdc-checkbox:mdc_checkbox_scss_lib",
"//src/material-experimental/mdc-chips:mdc_chips_scss_lib",
"//src/material-experimental/mdc-menu:mdc_menu_scss_lib",
"//src/material-experimental/mdc-radio:mdc_radio_scss_lib",
"//src/material-experimental/mdc-slide-toggle:mdc_slide_toggle_scss_lib",
"//src/material-experimental/mdc-tabs:mdc_tabs_scss_lib",
],
)
21 changes: 21 additions & 0 deletions src/material-experimental/mdc-typography/_all-typography.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import '../mdc-button/mdc-button';
@import '../mdc-card/mdc-card';
@import '../mdc-checkbox/mdc-checkbox';
@import '../mdc-chips/mdc-chips';
@import '../mdc-menu/mdc-menu';
@import '../mdc-radio/mdc-radio';
@import '../mdc-slide-toggle/mdc-slide-toggle';
@import '../mdc-tabs/mdc-tabs';

@mixin angular-material-typography-mdc($config: null) {
@include mat-button-typography-mdc($config);
@include mat-fab-typography-mdc($config);
@include mat-icon-button-typography-mdc($config);
@include mat-card-typography-mdc($config);
@include mat-checkbox-typography-mdc($config);
@include mat-chips-typography-mdc($config);
@include mat-menu-typography-mdc($config);
@include mat-radio-typography-mdc($config);
@include mat-slide-toggle-typography-mdc($config);
@include mat-tabs-typography-mdc($config);
}
5 changes: 4 additions & 1 deletion tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ def ng_web_test_suite(deps = [], static_css = [], bootstrap = [], **kwargs):
# that is needed for measuring, will unexpectedly fail. Also always adding a prebuilt theme
# reduces the amount of setup that is needed to create a test suite Bazel target. Note that the
# prebuilt theme will be also added to CDK test suites but shouldn't affect anything.
static_css = static_css + ["//src/material/prebuilt-themes:indigo-pink"]
static_css = static_css + [
"//src/material/prebuilt-themes:indigo-pink",
"//src/material-experimental/mdc-theming:indigo_pink_prebuilt",
]

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

0 comments on commit 59c9d32

Please sign in to comment.