Skip to content

Commit a28b5b0

Browse files
committed
build: use M3 theme in tests and internal apps
Switches unit tests, the e2e app and SSR app to use the M3 themes by default.
1 parent b312b94 commit a28b5b0

File tree

9 files changed

+40
-44
lines changed

9 files changed

+40
-44
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@import '@angular/material/prebuilt-themes/indigo-pink.css';
1+
@import '@angular/material/prebuilt-themes/azure-blue.css';

integration/yarn-pnp-compat/angular.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"tsConfig": "tsconfig.app.json",
2828
"inlineStyleLanguage": "scss",
2929
"assets": ["src/favicon.ico", "src/assets"],
30-
"styles": ["@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.scss"],
30+
"styles": ["@angular/material/prebuilt-themes/azure-blue.css", "src/styles.scss"],
3131
"scripts": []
3232
},
3333
"configurations": {
@@ -90,7 +90,7 @@
9090
"karmaConfig": "karma.conf.js",
9191
"inlineStyleLanguage": "scss",
9292
"assets": ["src/favicon.ico", "src/assets"],
93-
"styles": ["@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.scss"],
93+
"styles": ["@angular/material/prebuilt-themes/azure-blue.css", "src/styles.scss"],
9494
"scripts": []
9595
}
9696
}

src/e2e-app/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package(default_visibility = ["//visibility:public"])
88
devserverIndexHtmlDependencies = [
99
"@npm//zone.js",
1010
"@npm//kagekiri",
11-
"//src/material/prebuilt-themes:indigo-pink",
11+
"//src/material/prebuilt-themes:azure-blue",
1212
":index.html",
1313
":theme",
1414
]

src/e2e-app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
1212
<link href="theme.css" rel="stylesheet">
1313
</head>
14-
<body>
14+
<body class="mat-typography">
1515
<e2e-app>Loading...</e2e-app>
1616
<span class="sibling">I am a sibling!</span>
1717

src/e2e-app/theme.scss

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
@use '@angular/material' as mat;
2+
@use '@angular/material-experimental' as matx;
23

3-
// Plus imports for other components in your app.
4-
5-
// Disable legacy API compatibility, since e2e-app is fully migrated to theme inspection API.
6-
mat.$theme-legacy-inspection-api-compatibility: false;
7-
8-
// Include the common styles for Angular Material. We include this here so that you only
9-
// have to load a single css file for Angular Material in your app.
10-
// **Be sure that you only ever include this mixin once!**
114
@include mat.core();
125

13-
// Define the default theme (same as the example above).
14-
$candy-app-primary: mat.define-palette(mat.$indigo-palette);
15-
$candy-app-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
16-
$candy-app-theme: mat.define-light-theme((
17-
color: (primary: $candy-app-primary, accent: $candy-app-accent),
18-
typography: mat.define-typography-config(),
19-
density: 0
6+
$theme: matx.define-theme((
7+
color: (
8+
theme-type: light,
9+
primary: matx.$m3-azure-palette,
10+
tertiary: matx.$m3-blue-palette,
11+
),
12+
density: (
13+
scale: 0,
14+
)
2015
));
2116

22-
// Include the default theme styles.
23-
@include mat.all-component-themes($candy-app-theme);
17+
html {
18+
@include mat.all-component-themes($theme);
19+
}
20+
21+
@include mat.typography-hierarchy($theme);

src/material/sidenav/drawer.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,10 @@ describe('MatDrawerContainer', () => {
985985

986986
it('should recalculate the margin if a drawer changes size while open in autosize mode', fakeAsync(() => {
987987
const fixture = TestBed.createComponent(AutosizeDrawer);
988-
989988
fixture.detectChanges();
989+
990+
// In M3 the drawer has a fixed default width.
991+
fixture.nativeElement.querySelector('.mat-drawer').style.width = 'auto';
990992
fixture.componentInstance.drawer.open();
991993
fixture.detectChanges();
992994
tick();

src/universal-app/styles.scss

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
@use '@angular/material' as mat;
2+
@use '@angular/material-experimental' as matx;
23

3-
// Plus imports for other components in your app.
4-
5-
// Disable legacy API compatibility, since universal-app is fully migrated to theme inspection API.
6-
mat.$theme-legacy-inspection-api-compatibility: false;
7-
8-
// Include the common styles for Angular Material. We include this here so that you only
9-
// have to load a single css file for Angular Material in your app.
10-
// **Be sure that you only ever include this mixin once!**
114
@include mat.core();
125

13-
// Define the default theme (same as the example above).
14-
$candy-app-primary: mat.define-palette(mat.$indigo-palette);
15-
$candy-app-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
16-
$candy-app-theme: mat.define-light-theme((
17-
color: (primary: $candy-app-primary, accent: $candy-app-accent),
18-
typography: mat.define-typography-config(),
19-
density: 0
6+
$theme: matx.define-theme((
7+
color: (
8+
theme-type: light,
9+
primary: matx.$m3-azure-palette,
10+
tertiary: matx.$m3-blue-palette,
11+
),
12+
density: (
13+
scale: 0,
14+
)
2015
));
2116

22-
// Include the default theme styles.
23-
@include mat.all-component-themes($candy-app-theme);
24-
@include mat.typography-hierarchy($candy-app-theme);
17+
html {
18+
@include mat.all-component-themes($theme);
19+
}
20+
21+
@include mat.typography-hierarchy($theme);
2522

2623
body.test-automated {
2724
// Make sure bottom sheet doesn't obscure components.
@@ -38,4 +35,3 @@ body.test-automated {
3835
background: lime;
3936
}
4037
}
41-

test/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = config => {
6060
// Include a Material theme in the test suite. Also include the MDC theme as
6161
// karma runs tests for the MDC prototype components as well.
6262
{
63-
pattern: 'src/material/core/theming/prebuilt/indigo-pink.css',
63+
pattern: 'src/material/core/theming/prebuilt/azure-blue.css',
6464
included: true,
6565
watched: true,
6666
},

tools/defaults.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def ng_web_test_suite(deps = [], static_css = [], exclude_init_script = False, *
378378
# reduces the amount of setup that is needed to create a test suite Bazel target. Note that the
379379
# prebuilt theme will be also added to CDK test suites but shouldn't affect anything.
380380
static_css = static_css + [
381-
"//src/material/prebuilt-themes:indigo-pink",
381+
"//src/material/prebuilt-themes:azure-blue",
382382
]
383383

384384
# Workaround for https://github.com/bazelbuild/rules_typescript/issues/301

0 commit comments

Comments
 (0)