@angular/material 21.0.0-next.9 → 21.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/tokens/_classes.scss +1 -1
- package/core/tokens/m2/_md-sys-color.scss +17 -17
- package/fesm2022/_animation-chunk.mjs +10 -16
- package/fesm2022/_animation-chunk.mjs.map +1 -1
- package/fesm2022/_date-formats-chunk.mjs +68 -164
- package/fesm2022/_date-formats-chunk.mjs.map +1 -1
- package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
- package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_error-options-chunk.mjs +56 -19
- package/fesm2022/_error-options-chunk.mjs.map +1 -1
- package/fesm2022/_error-state-chunk.mjs +24 -31
- package/fesm2022/_error-state-chunk.mjs.map +1 -1
- package/fesm2022/_form-field-chunk.mjs +1224 -1017
- package/fesm2022/_form-field-chunk.mjs.map +1 -1
- package/fesm2022/_icon-button-chunk.mjs +243 -187
- package/fesm2022/_icon-button-chunk.mjs.map +1 -1
- package/fesm2022/_icon-registry-chunk.mjs +350 -575
- package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
- package/fesm2022/_input-harness-chunk.mjs +56 -107
- package/fesm2022/_input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
- package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
- package/fesm2022/_internal-form-field-chunk.mjs +59 -19
- package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
- package/fesm2022/_line-chunk.mjs +83 -43
- package/fesm2022/_line-chunk.mjs.map +1 -1
- package/fesm2022/_option-chunk.mjs +348 -311
- package/fesm2022/_option-chunk.mjs.map +1 -1
- package/fesm2022/_option-harness-chunk.mjs +23 -39
- package/fesm2022/_option-harness-chunk.mjs.map +1 -1
- package/fesm2022/_option-module-chunk.mjs +36 -10
- package/fesm2022/_option-module-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
- package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
- package/fesm2022/_public-api-chunk.mjs +71 -134
- package/fesm2022/_public-api-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-chunk.mjs +504 -600
- package/fesm2022/_ripple-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-loader-chunk.mjs +120 -138
- package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-module-chunk.mjs +36 -10
- package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
- package/fesm2022/_structural-styles-chunk.mjs +37 -10
- package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
- package/fesm2022/_tooltip-chunk.mjs +811 -888
- package/fesm2022/_tooltip-chunk.mjs.map +1 -1
- package/fesm2022/autocomplete-testing.mjs +62 -86
- package/fesm2022/autocomplete-testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +965 -1126
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge-testing.mjs +38 -54
- package/fesm2022/badge-testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +321 -272
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet-testing.mjs +10 -24
- package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +349 -344
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-testing.mjs +60 -94
- package/fesm2022/button-testing.mjs.map +1 -1
- package/fesm2022/button-toggle-testing.mjs +76 -125
- package/fesm2022/button-toggle-testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +752 -662
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +263 -158
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card-testing.mjs +19 -33
- package/fesm2022/card-testing.mjs.map +1 -1
- package/fesm2022/card.mjs +576 -272
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox-testing.mjs +71 -123
- package/fesm2022/checkbox-testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +515 -477
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips-testing.mjs +201 -344
- package/fesm2022/chips-testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +2552 -2289
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core-testing.mjs +14 -28
- package/fesm2022/core-testing.mjs.map +1 -1
- package/fesm2022/core.mjs +357 -328
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker-testing.mjs +15 -25
- package/fesm2022/datepicker-testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +4826 -4563
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog-testing.mjs +93 -129
- package/fesm2022/dialog-testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +810 -829
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider-testing.mjs +10 -11
- package/fesm2022/divider-testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +119 -43
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion-testing.mjs +74 -130
- package/fesm2022/expansion-testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +703 -515
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field-testing-control.mjs +16 -33
- package/fesm2022/form-field-testing-control.mjs.map +1 -1
- package/fesm2022/form-field-testing.mjs +118 -179
- package/fesm2022/form-field-testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -10
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list-testing.mjs +65 -113
- package/fesm2022/grid-list-testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +559 -494
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon-testing.mjs +148 -127
- package/fesm2022/icon-testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +325 -351
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input-testing.mjs +59 -99
- package/fesm2022/input-testing.mjs.map +1 -1
- package/fesm2022/input.mjs +457 -520
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list-testing.mjs +251 -434
- package/fesm2022/list-testing.mjs.map +1 -1
- package/fesm2022/list.mjs +1522 -1204
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/material.mjs +0 -5
- package/fesm2022/material.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +159 -228
- package/fesm2022/menu-testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +1338 -1343
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator-testing.mjs +55 -79
- package/fesm2022/paginator-testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +381 -309
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar-testing.mjs +12 -21
- package/fesm2022/progress-bar-testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +224 -169
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner-testing.mjs +13 -23
- package/fesm2022/progress-spinner-testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +235 -160
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio-testing.mjs +133 -208
- package/fesm2022/radio-testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +712 -679
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select-testing.mjs +83 -117
- package/fesm2022/select-testing.mjs.map +1 -1
- package/fesm2022/select.mjs +1116 -1246
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav-testing.mjs +54 -120
- package/fesm2022/sidenav-testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +1078 -995
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle-testing.mjs +57 -92
- package/fesm2022/slide-toggle-testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +369 -279
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider-testing.mjs +90 -138
- package/fesm2022/slider-testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +1651 -1716
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar-testing.mjs +40 -87
- package/fesm2022/snack-bar-testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +763 -714
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort-testing.mjs +45 -66
- package/fesm2022/sort-testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +419 -344
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper-testing.mjs +78 -154
- package/fesm2022/stepper-testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +790 -498
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table-testing.mjs +120 -213
- package/fesm2022/table-testing.mjs.map +1 -1
- package/fesm2022/table.mjs +1026 -684
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +125 -197
- package/fesm2022/tabs-testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +2351 -2028
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker-testing.mjs +113 -172
- package/fesm2022/timepicker-testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +1019 -826
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +16 -27
- package/fesm2022/toolbar-testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +163 -78
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip-testing.mjs +41 -52
- package/fesm2022/tooltip-testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +36 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +86 -162
- package/fesm2022/tree-testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +638 -466
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/types/expansion.d.ts +4 -2
- package/types/menu-testing.d.ts +2 -0
- package/types/select.d.ts +1 -1
- package/types/timepicker.d.ts +1 -0
|
@@ -1,381 +1,238 @@
|
|
|
1
1
|
import { ComponentHarness, HarnessPredicate, ContentContainerComponentHarness, TestKey, parallel } from '@angular/cdk/testing';
|
|
2
2
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
3
3
|
|
|
4
|
-
/** Harness for interacting with a standard Material chip avatar in tests. */
|
|
5
4
|
class MatChipAvatarHarness extends ComponentHarness {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @param options Options for filtering which input instances are considered a match.
|
|
11
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
12
|
-
*/
|
|
13
|
-
static with(options = {}) {
|
|
14
|
-
return new HarnessPredicate(this, options);
|
|
15
|
-
}
|
|
5
|
+
static hostSelector = '.mat-mdc-chip-avatar';
|
|
6
|
+
static with(options = {}) {
|
|
7
|
+
return new HarnessPredicate(this, options);
|
|
8
|
+
}
|
|
16
9
|
}
|
|
17
10
|
|
|
18
|
-
/** Harness for interacting with a standard Material chip edit button in tests. */
|
|
19
11
|
class MatChipEditHarness extends ComponentHarness {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
static with(options = {}) {
|
|
28
|
-
return new HarnessPredicate(this, options);
|
|
29
|
-
}
|
|
30
|
-
/** Clicks the edit button. */
|
|
31
|
-
async click() {
|
|
32
|
-
return (await this.host()).click();
|
|
33
|
-
}
|
|
12
|
+
static hostSelector = '.mat-mdc-chip-edit';
|
|
13
|
+
static with(options = {}) {
|
|
14
|
+
return new HarnessPredicate(this, options);
|
|
15
|
+
}
|
|
16
|
+
async click() {
|
|
17
|
+
return (await this.host()).click();
|
|
18
|
+
}
|
|
34
19
|
}
|
|
35
20
|
|
|
36
|
-
/** Harness for interacting with a standard Material chip remove button in tests. */
|
|
37
21
|
class MatChipRemoveHarness extends ComponentHarness {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
static with(options = {}) {
|
|
46
|
-
return new HarnessPredicate(this, options);
|
|
47
|
-
}
|
|
48
|
-
/** Clicks the remove button. */
|
|
49
|
-
async click() {
|
|
50
|
-
return (await this.host()).click();
|
|
51
|
-
}
|
|
22
|
+
static hostSelector = '.mat-mdc-chip-remove';
|
|
23
|
+
static with(options = {}) {
|
|
24
|
+
return new HarnessPredicate(this, options);
|
|
25
|
+
}
|
|
26
|
+
async click() {
|
|
27
|
+
return (await this.host()).click();
|
|
28
|
+
}
|
|
52
29
|
}
|
|
53
30
|
|
|
54
|
-
/** Harness for interacting with a mat-chip in tests. */
|
|
55
31
|
class MatChipHarness extends ContentContainerComponentHarness {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Gets the edit button inside of a chip.
|
|
89
|
-
* @param filter Optionally filters which chips are included.
|
|
90
|
-
*/
|
|
91
|
-
async geEditButton(filter = {}) {
|
|
92
|
-
return this.locatorFor(MatChipEditHarness.with(filter))();
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Gets the remove button inside of a chip.
|
|
96
|
-
* @param filter Optionally filters which chips are included.
|
|
97
|
-
*/
|
|
98
|
-
async getRemoveButton(filter = {}) {
|
|
99
|
-
return this.locatorFor(MatChipRemoveHarness.with(filter))();
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Gets the avatar inside a chip.
|
|
103
|
-
* @param filter Optionally filters which avatars are included.
|
|
104
|
-
*/
|
|
105
|
-
async getAvatar(filter = {}) {
|
|
106
|
-
return this.locatorForOptional(MatChipAvatarHarness.with(filter))();
|
|
107
|
-
}
|
|
32
|
+
_primaryAction = this.locatorFor('.mdc-evolution-chip__action--primary');
|
|
33
|
+
static hostSelector = '.mat-mdc-basic-chip, .mat-mdc-chip';
|
|
34
|
+
static with(options = {}) {
|
|
35
|
+
return new HarnessPredicate(this, options).addOption('text', options.text, (harness, label) => {
|
|
36
|
+
return HarnessPredicate.stringMatches(harness.getText(), label);
|
|
37
|
+
}).addOption('disabled', options.disabled, async (harness, disabled) => {
|
|
38
|
+
return (await harness.isDisabled()) === disabled;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async getText() {
|
|
42
|
+
return (await this.host()).text({
|
|
43
|
+
exclude: '.mat-mdc-chip-avatar, .mat-mdc-chip-trailing-icon, .mat-icon'
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async isDisabled() {
|
|
47
|
+
return (await this.host()).hasClass('mat-mdc-chip-disabled');
|
|
48
|
+
}
|
|
49
|
+
async remove() {
|
|
50
|
+
const hostEl = await this.host();
|
|
51
|
+
await hostEl.sendKeys(TestKey.DELETE);
|
|
52
|
+
}
|
|
53
|
+
async geEditButton(filter = {}) {
|
|
54
|
+
return this.locatorFor(MatChipEditHarness.with(filter))();
|
|
55
|
+
}
|
|
56
|
+
async getRemoveButton(filter = {}) {
|
|
57
|
+
return this.locatorFor(MatChipRemoveHarness.with(filter))();
|
|
58
|
+
}
|
|
59
|
+
async getAvatar(filter = {}) {
|
|
60
|
+
return this.locatorForOptional(MatChipAvatarHarness.with(filter))();
|
|
61
|
+
}
|
|
108
62
|
}
|
|
109
63
|
|
|
110
|
-
/** Harness for interacting with a grid's chip input in tests. */
|
|
111
64
|
class MatChipInputHarness extends ComponentHarness {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Blurs the input and returns a promise that indicates when the
|
|
162
|
-
* action is complete.
|
|
163
|
-
*/
|
|
164
|
-
async blur() {
|
|
165
|
-
return (await this.host()).blur();
|
|
166
|
-
}
|
|
167
|
-
/** Whether the input is focused. */
|
|
168
|
-
async isFocused() {
|
|
169
|
-
return (await this.host()).isFocused();
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Sets the value of the input. The value will be set by simulating
|
|
173
|
-
* keypresses that correspond to the given value.
|
|
174
|
-
*/
|
|
175
|
-
async setValue(newValue) {
|
|
176
|
-
const inputEl = await this.host();
|
|
177
|
-
await inputEl.clear();
|
|
178
|
-
// We don't want to send keys for the value if the value is an empty
|
|
179
|
-
// string in order to clear the value. Sending keys with an empty string
|
|
180
|
-
// still results in unnecessary focus events.
|
|
181
|
-
if (newValue) {
|
|
182
|
-
await inputEl.sendKeys(newValue);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
/** Sends a chip separator key to the input element. */
|
|
186
|
-
async sendSeparatorKey(key) {
|
|
187
|
-
const inputEl = await this.host();
|
|
188
|
-
return inputEl.sendKeys(key);
|
|
189
|
-
}
|
|
65
|
+
static hostSelector = '.mat-mdc-chip-input';
|
|
66
|
+
static with(options = {}) {
|
|
67
|
+
return new HarnessPredicate(this, options).addOption('value', options.value, async (harness, value) => {
|
|
68
|
+
return (await harness.getValue()) === value;
|
|
69
|
+
}).addOption('placeholder', options.placeholder, async (harness, placeholder) => {
|
|
70
|
+
return (await harness.getPlaceholder()) === placeholder;
|
|
71
|
+
}).addOption('disabled', options.disabled, async (harness, disabled) => {
|
|
72
|
+
return (await harness.isDisabled()) === disabled;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async isDisabled() {
|
|
76
|
+
const host = await this.host();
|
|
77
|
+
const disabled = await host.getAttribute('disabled');
|
|
78
|
+
if (disabled !== null) {
|
|
79
|
+
return coerceBooleanProperty(disabled);
|
|
80
|
+
}
|
|
81
|
+
return (await host.getAttribute('aria-disabled')) === 'true';
|
|
82
|
+
}
|
|
83
|
+
async isRequired() {
|
|
84
|
+
return (await this.host()).getProperty('required');
|
|
85
|
+
}
|
|
86
|
+
async getValue() {
|
|
87
|
+
return await (await this.host()).getProperty('value');
|
|
88
|
+
}
|
|
89
|
+
async getPlaceholder() {
|
|
90
|
+
return await (await this.host()).getProperty('placeholder');
|
|
91
|
+
}
|
|
92
|
+
async focus() {
|
|
93
|
+
return (await this.host()).focus();
|
|
94
|
+
}
|
|
95
|
+
async blur() {
|
|
96
|
+
return (await this.host()).blur();
|
|
97
|
+
}
|
|
98
|
+
async isFocused() {
|
|
99
|
+
return (await this.host()).isFocused();
|
|
100
|
+
}
|
|
101
|
+
async setValue(newValue) {
|
|
102
|
+
const inputEl = await this.host();
|
|
103
|
+
await inputEl.clear();
|
|
104
|
+
if (newValue) {
|
|
105
|
+
await inputEl.sendKeys(newValue);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async sendSeparatorKey(key) {
|
|
109
|
+
const inputEl = await this.host();
|
|
110
|
+
return inputEl.sendKeys(key);
|
|
111
|
+
}
|
|
190
112
|
}
|
|
191
113
|
|
|
192
|
-
/** Harness for interacting with a mat-chip-option in tests. */
|
|
193
114
|
class MatChipOptionHarness extends MatChipHarness {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
/** Deselects the given chip. Only applies if it's selectable. */
|
|
217
|
-
async deselect() {
|
|
218
|
-
if (await this.isSelected()) {
|
|
219
|
-
await this.toggle();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/** Toggles the selected state of the given chip. */
|
|
223
|
-
async toggle() {
|
|
224
|
-
return (await this._primaryAction()).click();
|
|
225
|
-
}
|
|
115
|
+
static hostSelector = '.mat-mdc-chip-option';
|
|
116
|
+
static with(options = {}) {
|
|
117
|
+
return new HarnessPredicate(MatChipOptionHarness, options).addOption('text', options.text, (harness, label) => HarnessPredicate.stringMatches(harness.getText(), label)).addOption('selected', options.selected, async (harness, selected) => (await harness.isSelected()) === selected);
|
|
118
|
+
}
|
|
119
|
+
async isSelected() {
|
|
120
|
+
return (await this.host()).hasClass('mat-mdc-chip-selected');
|
|
121
|
+
}
|
|
122
|
+
async select() {
|
|
123
|
+
if (!(await this.isSelected())) {
|
|
124
|
+
await this.toggle();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async deselect() {
|
|
128
|
+
if (await this.isSelected()) {
|
|
129
|
+
await this.toggle();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async toggle() {
|
|
133
|
+
return (await this._primaryAction()).click();
|
|
134
|
+
}
|
|
226
135
|
}
|
|
227
136
|
|
|
228
|
-
/** Harness for interacting with a mat-chip-listbox in tests. */
|
|
229
137
|
class MatChipListboxHarness extends ComponentHarness {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Gets the list of chips inside the chip list.
|
|
261
|
-
* @param filter Optionally filters which chips are included.
|
|
262
|
-
*/
|
|
263
|
-
async getChips(filter = {}) {
|
|
264
|
-
return this.locatorForAll(MatChipOptionHarness.with(filter))();
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Selects a chip inside the chip list.
|
|
268
|
-
* @param filter An optional filter to apply to the child chips.
|
|
269
|
-
* All the chips matching the filter will be selected.
|
|
270
|
-
*/
|
|
271
|
-
async selectChips(filter = {}) {
|
|
272
|
-
const chips = await this.getChips(filter);
|
|
273
|
-
if (!chips.length) {
|
|
274
|
-
throw Error(`Cannot find chip matching filter ${JSON.stringify(filter)}`);
|
|
275
|
-
}
|
|
276
|
-
await parallel(() => chips.map(chip => chip.select()));
|
|
277
|
-
}
|
|
138
|
+
static hostSelector = '.mat-mdc-chip-listbox';
|
|
139
|
+
static with(options = {}) {
|
|
140
|
+
return new HarnessPredicate(this, options).addOption('disabled', options.disabled, async (harness, disabled) => {
|
|
141
|
+
return (await harness.isDisabled()) === disabled;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async isDisabled() {
|
|
145
|
+
return (await (await this.host()).getAttribute('aria-disabled')) === 'true';
|
|
146
|
+
}
|
|
147
|
+
async isRequired() {
|
|
148
|
+
return (await (await this.host()).getAttribute('aria-required')) === 'true';
|
|
149
|
+
}
|
|
150
|
+
async isMultiple() {
|
|
151
|
+
return (await (await this.host()).getAttribute('aria-multiselectable')) === 'true';
|
|
152
|
+
}
|
|
153
|
+
async getOrientation() {
|
|
154
|
+
const orientation = await (await this.host()).getAttribute('aria-orientation');
|
|
155
|
+
return orientation === 'vertical' ? 'vertical' : 'horizontal';
|
|
156
|
+
}
|
|
157
|
+
async getChips(filter = {}) {
|
|
158
|
+
return this.locatorForAll(MatChipOptionHarness.with(filter))();
|
|
159
|
+
}
|
|
160
|
+
async selectChips(filter = {}) {
|
|
161
|
+
const chips = await this.getChips(filter);
|
|
162
|
+
if (!chips.length) {
|
|
163
|
+
throw Error(`Cannot find chip matching filter ${JSON.stringify(filter)}`);
|
|
164
|
+
}
|
|
165
|
+
await parallel(() => chips.map(chip => chip.select()));
|
|
166
|
+
}
|
|
278
167
|
}
|
|
279
168
|
|
|
280
|
-
/** Harness for interacting with an editable chip's input in tests. */
|
|
281
169
|
class MatChipEditInputHarness extends ComponentHarness {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return new HarnessPredicate(this, options);
|
|
291
|
-
}
|
|
292
|
-
/** Sets the value of the input. */
|
|
293
|
-
async setValue(value) {
|
|
294
|
-
const host = await this.host();
|
|
295
|
-
return host.setContenteditableValue(value);
|
|
296
|
-
}
|
|
170
|
+
static hostSelector = '.mat-chip-edit-input';
|
|
171
|
+
static with(options = {}) {
|
|
172
|
+
return new HarnessPredicate(this, options);
|
|
173
|
+
}
|
|
174
|
+
async setValue(value) {
|
|
175
|
+
const host = await this.host();
|
|
176
|
+
return host.setContenteditableValue(value);
|
|
177
|
+
}
|
|
297
178
|
}
|
|
298
179
|
|
|
299
|
-
/** Harness for interacting with a mat-chip-row in tests. */
|
|
300
180
|
class MatChipRowHarness extends MatChipHarness {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
323
|
-
/** Gets the edit input inside the chip row. */
|
|
324
|
-
async getEditInput(filter = {}) {
|
|
325
|
-
return this.locatorFor(MatChipEditInputHarness.with(filter))();
|
|
326
|
-
}
|
|
181
|
+
static hostSelector = '.mat-mdc-chip-row';
|
|
182
|
+
async isEditable() {
|
|
183
|
+
return (await this.host()).hasClass('mat-mdc-chip-editable');
|
|
184
|
+
}
|
|
185
|
+
async isEditing() {
|
|
186
|
+
return (await this.host()).hasClass('mat-mdc-chip-editing');
|
|
187
|
+
}
|
|
188
|
+
async startEditing() {
|
|
189
|
+
if (!(await this.isEditable())) {
|
|
190
|
+
throw new Error('Cannot begin editing a chip that is not editable.');
|
|
191
|
+
}
|
|
192
|
+
return (await this.host()).dispatchEvent('dblclick');
|
|
193
|
+
}
|
|
194
|
+
async finishEditing() {
|
|
195
|
+
if (await this.isEditing()) {
|
|
196
|
+
await (await this.host()).sendKeys(TestKey.ENTER);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async getEditInput(filter = {}) {
|
|
200
|
+
return this.locatorFor(MatChipEditInputHarness.with(filter))();
|
|
201
|
+
}
|
|
327
202
|
}
|
|
328
203
|
|
|
329
|
-
/** Harness for interacting with a mat-chip-grid in tests. */
|
|
330
204
|
class MatChipGridHarness extends ComponentHarness {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return (await (await this.host()).getAttribute('aria-invalid')) === 'true';
|
|
353
|
-
}
|
|
354
|
-
/** Gets promise of the harnesses for the chip rows. */
|
|
355
|
-
getRows(filter = {}) {
|
|
356
|
-
return this.locatorForAll(MatChipRowHarness.with(filter))();
|
|
357
|
-
}
|
|
358
|
-
/** Gets promise of the chip text input harness. */
|
|
359
|
-
getInput(filter = {}) {
|
|
360
|
-
return this.locatorFor(MatChipInputHarness.with(filter))();
|
|
361
|
-
}
|
|
205
|
+
static hostSelector = '.mat-mdc-chip-grid';
|
|
206
|
+
static with(options = {}) {
|
|
207
|
+
return new HarnessPredicate(this, options).addOption('disabled', options.disabled, async (harness, disabled) => {
|
|
208
|
+
return (await harness.isDisabled()) === disabled;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
async isDisabled() {
|
|
212
|
+
return (await (await this.host()).getAttribute('aria-disabled')) === 'true';
|
|
213
|
+
}
|
|
214
|
+
async isRequired() {
|
|
215
|
+
return await (await this.host()).hasClass('mat-mdc-chip-list-required');
|
|
216
|
+
}
|
|
217
|
+
async isInvalid() {
|
|
218
|
+
return (await (await this.host()).getAttribute('aria-invalid')) === 'true';
|
|
219
|
+
}
|
|
220
|
+
getRows(filter = {}) {
|
|
221
|
+
return this.locatorForAll(MatChipRowHarness.with(filter))();
|
|
222
|
+
}
|
|
223
|
+
getInput(filter = {}) {
|
|
224
|
+
return this.locatorFor(MatChipInputHarness.with(filter))();
|
|
225
|
+
}
|
|
362
226
|
}
|
|
363
227
|
|
|
364
|
-
/** Harness for interacting with a mat-chip-set in tests. */
|
|
365
228
|
class MatChipSetHarness extends ComponentHarness {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
return new HarnessPredicate(this, options);
|
|
374
|
-
}
|
|
375
|
-
/** Gets promise of the harnesses for the chips. */
|
|
376
|
-
async getChips(filter = {}) {
|
|
377
|
-
return await this.locatorForAll(MatChipHarness.with(filter))();
|
|
378
|
-
}
|
|
229
|
+
static hostSelector = '.mat-mdc-chip-set';
|
|
230
|
+
static with(options = {}) {
|
|
231
|
+
return new HarnessPredicate(this, options);
|
|
232
|
+
}
|
|
233
|
+
async getChips(filter = {}) {
|
|
234
|
+
return await this.locatorForAll(MatChipHarness.with(filter))();
|
|
235
|
+
}
|
|
379
236
|
}
|
|
380
237
|
|
|
381
238
|
export { MatChipAvatarHarness, MatChipEditHarness, MatChipEditInputHarness, MatChipGridHarness, MatChipHarness, MatChipInputHarness, MatChipListboxHarness, MatChipOptionHarness, MatChipRemoveHarness, MatChipRowHarness, MatChipSetHarness };
|