Skip to content

Commit 5a3ddb7

Browse files
committed
feat(material-experimental): add test harness for select
Sets up the test harness for `mat-select`.
1 parent dd42956 commit 5a3ddb7

File tree

15 files changed

+621
-1
lines changed

15 files changed

+621
-1
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
/src/material-experimental/mdc-chips/** @mmalerba
9595
/src/material-experimental/mdc-helpers/** @mmalerba
9696
/src/material-experimental/mdc-menu/** @crisbeto
97+
/src/material-experimental/mdc-select/** @crisbeto
9798
/src/material-experimental/mdc-progress-spinner/** @andrewseguin
9899
/src/material-experimental/mdc-progress-bar/** @andrewseguin
99100
# Note to implementer: please repossess

src/cdk-experimental/testing/testbed/testbed-harness-environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class TestbedHarnessEnvironment extends HarnessEnvironment<Element> {
3737
}
3838

3939
protected getDocumentRoot(): Element {
40-
return this._fixture.nativeElement;
40+
return document.body;
4141
}
4242

4343
protected createTestElement(element: Element): TestElement {
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
4+
load("//tools:defaults.bzl", "ng_e2e_test_library", "ng_module", "ng_test_library", "ng_web_test_suite", "ts_library")
5+
load("//src/e2e-app:test_suite.bzl", "e2e_test_suite")
6+
7+
ng_module(
8+
name = "mdc-select",
9+
srcs = glob(
10+
["**/*.ts"],
11+
exclude = [
12+
"**/*.spec.ts",
13+
"harness/**",
14+
],
15+
),
16+
assets = [
17+
# TODO: include scss assets
18+
] + glob(["**/*.html"]),
19+
module_name = "@angular/material-experimental/mdc-select",
20+
deps = [
21+
"//src/material/core",
22+
],
23+
)
24+
25+
ts_library(
26+
name = "harness",
27+
srcs = glob(
28+
["harness/**/*.ts"],
29+
exclude = ["**/*.spec.ts"],
30+
),
31+
deps = [
32+
"//src/cdk-experimental/testing",
33+
],
34+
)
35+
36+
sass_library(
37+
name = "mdc_select_scss_lib",
38+
srcs = glob(["**/_*.scss"]),
39+
deps = [
40+
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
41+
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
42+
"//src/material/core:core_scss_lib",
43+
],
44+
)
45+
46+
sass_binary(
47+
name = "select_scss",
48+
src = "select.scss",
49+
include_paths = [
50+
"external/npm/node_modules",
51+
],
52+
deps = [
53+
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
54+
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
55+
"//src/material/core:all_themes",
56+
],
57+
)
58+
59+
ng_test_library(
60+
name = "select_tests_lib",
61+
srcs = [
62+
"harness/select-harness.spec.ts",
63+
],
64+
deps = [
65+
":harness",
66+
":mdc-select",
67+
"//src/cdk-experimental/testing",
68+
"//src/cdk-experimental/testing/testbed",
69+
"//src/cdk/platform",
70+
"//src/cdk/testing",
71+
"//src/material/form-field",
72+
"//src/material/select",
73+
"@npm//@angular/forms",
74+
"@npm//@angular/platform-browser",
75+
],
76+
)
77+
78+
ng_web_test_suite(
79+
name = "unit_tests",
80+
deps = [
81+
":select_tests_lib",
82+
"//src/material-experimental:mdc_require_config.js",
83+
],
84+
)
85+
86+
ng_e2e_test_library(
87+
name = "e2e_test_sources",
88+
srcs = glob(["**/*.e2e.spec.ts"]),
89+
deps = [
90+
"//src/cdk/private/testing/e2e",
91+
],
92+
)
93+
94+
e2e_test_suite(
95+
name = "e2e_tests",
96+
deps = [
97+
":e2e_test_sources",
98+
"//src/cdk/private/testing/e2e",
99+
],
100+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- TODO -->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@import '../mdc-helpers/mdc-helpers';
2+
3+
@mixin mat-select-theme-mdc($theme) {
4+
@include mat-using-mdc-theme($theme) {
5+
// TODO: implement MDC-based select.
6+
}
7+
}
8+
9+
@mixin mat-select-typography-mdc($config) {
10+
@include mat-using-mdc-typography($config) {
11+
// TODO: implement MDC-based select.
12+
}
13+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import {ComponentHarness} from '@angular/cdk-experimental/testing';
10+
11+
12+
/**
13+
* Harness for interacting with a MDC-based mat-select in tests.
14+
* @dynamic
15+
*/
16+
export class MatSelectHarness extends ComponentHarness {
17+
// TODO: implement once MDC select is done.
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export type SelectHarnessFilters = {
10+
id?: string;
11+
};

0 commit comments

Comments
 (0)