Skip to content

Commit f343ded

Browse files
authored
feat(stepper): add test harness (#20092)
Adds test harnesses for the stepper-related components.
1 parent fe14d88 commit f343ded

File tree

13 files changed

+750
-2
lines changed

13 files changed

+750
-2
lines changed

src/material/config.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ entryPoints = [
5555
"sort",
5656
"sort/testing",
5757
"stepper",
58+
"stepper/testing",
5859
"table",
5960
"table/testing",
6061
"tabs",

src/material/stepper/step-header.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
[class.mat-step-label-selected]="selected"
2020
[class.mat-step-label-error]="state == 'error'">
2121
<!-- If there is a label template, use it. -->
22-
<ng-container *ngIf="_templateLabel()" [ngTemplateOutlet]="_templateLabel()!.template">
23-
</ng-container>
22+
<div class="mat-step-text-label" *ngIf="_templateLabel()">
23+
<ng-container [ngTemplateOutlet]="_templateLabel()!.template"></ng-container>
24+
</div>
2425
<!-- If there is no label template, fall back to the text label. -->
2526
<div class="mat-step-text-label" *ngIf="_stringLabel()">{{label}}</div>
2627

src/material/stepper/stepper-button.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {Directive} from '@angular/core';
1313
@Directive({
1414
selector: 'button[matStepperNext]',
1515
host: {
16+
'class': 'mat-stepper-next',
1617
'[type]': 'type',
1718
},
1819
inputs: ['type']
@@ -24,6 +25,7 @@ export class MatStepperNext extends CdkStepperNext {
2425
@Directive({
2526
selector: 'button[matStepperPrevious]',
2627
host: {
28+
'class': 'mat-stepper-previous',
2729
'[type]': 'type',
2830
},
2931
inputs: ['type']
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
load("//tools:defaults.bzl", "ng_test_library", "ng_web_test_suite", "ts_library")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
ts_library(
6+
name = "testing",
7+
srcs = glob(
8+
["**/*.ts"],
9+
exclude = ["**/*.spec.ts"],
10+
),
11+
module_name = "@angular/material/stepper/testing",
12+
deps = [
13+
"//src/cdk/testing",
14+
],
15+
)
16+
17+
filegroup(
18+
name = "source-files",
19+
srcs = glob(["**/*.ts"]),
20+
)
21+
22+
ng_test_library(
23+
name = "harness_tests_lib",
24+
srcs = ["shared.spec.ts"],
25+
deps = [
26+
":testing",
27+
"//src/cdk/stepper",
28+
"//src/cdk/testing",
29+
"//src/cdk/testing/private",
30+
"//src/cdk/testing/testbed",
31+
"//src/material/stepper",
32+
"@npm//@angular/forms",
33+
"@npm//@angular/platform-browser",
34+
],
35+
)
36+
37+
ng_test_library(
38+
name = "unit_tests_lib",
39+
srcs = glob(
40+
["**/*.spec.ts"],
41+
exclude = ["shared.spec.ts"],
42+
),
43+
deps = [
44+
":harness_tests_lib",
45+
":testing",
46+
"//src/material/stepper",
47+
],
48+
)
49+
50+
ng_web_test_suite(
51+
name = "unit_tests",
52+
deps = [":unit_tests_lib"],
53+
)

src/material/stepper/testing/index.ts

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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 './stepper-harness';
10+
export * from './step-harness';
11+
export * from './step-harness-filters';
12+
export * from './stepper-button-harnesses';

0 commit comments

Comments
 (0)