Skip to content

Commit 09ded04

Browse files
mmalerbajelbourn
authored andcommitted
feat(checkbox): move checkbox harness out of experimental (#17067)
1 parent b454e38 commit 09ded04

File tree

14 files changed

+168
-53
lines changed

14 files changed

+168
-53
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
4+
5+
ng_module(
6+
name = "testing",
7+
srcs = glob(
8+
["**/*.ts"],
9+
exclude = ["**/*.spec.ts"],
10+
),
11+
module_name = "@angular/material-experimental/mdc-checkbox/testing",
12+
deps = [
13+
"//src/cdk/coercion",
14+
"//src/cdk/testing",
15+
"//src/material/checkbox/testing",
16+
],
17+
)
18+
19+
ng_test_library(
20+
name = "unit_tests_lib",
21+
srcs = glob(["**/*.spec.ts"]),
22+
deps = [
23+
":testing",
24+
"//src/material-experimental/mdc-checkbox",
25+
"//src/material/checkbox/testing:shared_unit_tests",
26+
],
27+
)
28+
29+
ng_web_test_suite(
30+
name = "unit_tests",
31+
static_files = [
32+
"@npm//:node_modules/@material/checkbox/dist/mdc.checkbox.js",
33+
"@npm//:node_modules/@material/ripple/dist/mdc.ripple.js",
34+
],
35+
deps = [
36+
":unit_tests_lib",
37+
"//src/material-experimental:mdc_require_config.js",
38+
],
39+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {MatCheckboxModule} from '../index';
2+
import {MatCheckboxHarness} from './checkbox-harness';
3+
import {runTests} from '@angular/material/checkbox/testing/shared.spec';
4+
5+
describe('MDC-based MatCheckboxHarness', () => {
6+
runTests(MatCheckboxModule, MatCheckboxHarness as any);
7+
});

src/material-experimental/mdc-checkbox/harness/mdc-checkbox-harness.ts renamed to src/material-experimental/mdc-checkbox/testing/checkbox-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
1010
import {coerceBooleanProperty} from '@angular/cdk/coercion';
11-
import {CheckboxHarnessFilters} from './checkbox-harness-filters';
11+
import {CheckboxHarnessFilters} from '@angular/material/checkbox/testing';
1212

1313
/**
1414
* Harness for interacting with a MDC-based mat-checkbox in tests.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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 * from './public-api';
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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 * from './checkbox-harness';
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite")
4+
5+
ng_module(
6+
name = "testing",
7+
srcs = glob(
8+
["**/*.ts"],
9+
exclude = ["**/*.spec.ts"],
10+
),
11+
module_name = "@angular/material/checkbox/testing",
12+
deps = [
13+
"//src/cdk/coercion",
14+
"//src/cdk/testing",
15+
],
16+
)
17+
18+
ng_test_library(
19+
name = "shared_unit_tests",
20+
srcs = ["shared.spec.ts"],
21+
deps = [
22+
":testing",
23+
"//src/cdk/testing",
24+
"//src/cdk/testing/testbed",
25+
"//src/material/checkbox",
26+
"@npm//@angular/forms",
27+
"@npm//@angular/platform-browser",
28+
],
29+
)
30+
31+
ng_test_library(
32+
name = "unit_tests_lib",
33+
srcs = glob(
34+
["**/*.spec.ts"],
35+
exclude = ["shared.spec.ts"],
36+
),
37+
deps = [
38+
":shared_unit_tests",
39+
":testing",
40+
"//src/material/checkbox",
41+
],
42+
)
43+
44+
ng_web_test_suite(
45+
name = "unit_tests",
46+
deps = [":unit_tests_lib"],
47+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {MatCheckboxModule} from '@angular/material/checkbox';
2+
import {MatCheckboxHarness} from './checkbox-harness';
3+
import {runTests} from '@angular/material/checkbox/testing/shared.spec';
4+
5+
describe('Non-MDC-based MatCheckboxHarness', () => {
6+
runTests(MatCheckboxModule, MatCheckboxHarness);
7+
});

src/material-experimental/mdc-checkbox/harness/checkbox-harness.ts renamed to src/material/checkbox/testing/checkbox-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
109
import {coerceBooleanProperty} from '@angular/cdk/coercion';
10+
import {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
1111
import {CheckboxHarnessFilters} from './checkbox-harness-filters';
1212

1313
/**
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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 * from './public-api';

0 commit comments

Comments
 (0)