@angular/material 11.2.1 → 11.2.2
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/_theming.scss +153 -150
- package/autocomplete/_autocomplete-theme.import.scss +2 -0
- package/autocomplete/autocomplete.d.ts +1 -1
- package/badge/_badge-theme.import.scss +5 -0
- package/bottom-sheet/_bottom-sheet-theme.import.scss +4 -0
- package/bottom-sheet/bottom-sheet-container.d.ts +2 -0
- package/bottom-sheet/index.metadata.json +1 -1
- package/bundles/material-autocomplete.umd.js.map +1 -1
- package/bundles/material-bottom-sheet.umd.js +11 -3
- package/bundles/material-bottom-sheet.umd.js.map +1 -1
- package/bundles/material-bottom-sheet.umd.min.js +1 -1
- package/bundles/material-bottom-sheet.umd.min.js.map +1 -1
- package/bundles/material-core.umd.js +3 -3
- package/bundles/material-core.umd.js.map +1 -1
- package/bundles/material-core.umd.min.js +3 -3
- package/bundles/material-core.umd.min.js.map +1 -1
- package/bundles/material-form-field-testing.umd.js +137 -140
- package/bundles/material-form-field-testing.umd.js.map +1 -1
- package/bundles/material-form-field-testing.umd.min.js +3 -3
- package/bundles/material-form-field-testing.umd.min.js.map +1 -1
- package/bundles/material-select.umd.js +1 -1
- package/bundles/material-select.umd.js.map +1 -1
- package/bundles/material-select.umd.min.js.map +1 -1
- package/button/_button-base.import.scss +4 -0
- package/button/_button-theme.import.scss +3 -0
- package/button-toggle/_button-toggle-theme.import.scss +6 -0
- package/button-toggle/_button-toggle-variables.import.scss +1 -0
- package/card/_card-theme.import.scss +4 -0
- package/checkbox/_checkbox-theme.import.scss +3 -0
- package/chips/_chips-theme.import.scss +4 -0
- package/core/_core.import.scss +10 -0
- package/core/color/_all-color.import.scss +3 -0
- package/core/density/private/_all-density.import.scss +9 -0
- package/core/density/private/_compatibility.import.scss +1 -0
- package/core/focus-indicators/_focus-indicators.import.scss +3 -0
- package/core/index.metadata.json +1 -1
- package/core/option/_optgroup-theme.import.scss +4 -0
- package/core/option/_option-theme.import.scss +4 -0
- package/core/ripple/_ripple.import.scss +3 -0
- package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.import.scss +2 -0
- package/core/style/_button-common.import.scss +2 -0
- package/core/style/_checkbox-common.import.scss +2 -0
- package/core/style/_elevation.import.scss +2 -0
- package/core/style/_form-common.import.scss +2 -0
- package/core/style/_layout-common.import.scss +1 -0
- package/core/style/_list-common.import.scss +1 -0
- package/core/style/_menu-common.import.scss +5 -0
- package/core/style/_private.import.scss +2 -0
- package/core/style/_variables.import.scss +1 -0
- package/core/style/_vendor-prefixes.import.scss +1 -0
- package/core/theming/_all-theme.import.scss +37 -0
- package/core/theming/_palette.import.scss +1 -0
- package/core/theming/_theming.import.scss +2 -0
- package/core/theming/_theming.scss +1 -0
- package/core/typography/_all-typography.import.scss +38 -0
- package/core/typography/_typography-utils.import.scss +1 -0
- package/core/typography/_typography.import.scss +2 -0
- package/datepicker/_datepicker-theme.import.scss +4 -0
- package/dialog/_dialog-theme.import.scss +4 -0
- package/divider/_divider-offset.import.scss +1 -0
- package/divider/_divider-theme.import.scss +3 -0
- package/esm2015/autocomplete/autocomplete.js +1 -1
- package/esm2015/bottom-sheet/bottom-sheet-container.js +12 -4
- package/esm2015/core/common-behaviors/common-module.js +1 -1
- package/esm2015/core/option/optgroup.js +2 -2
- package/esm2015/core/version.js +1 -1
- package/esm2015/form-field/testing/form-field-harness.js +68 -76
- package/esm2015/select/select.js +2 -2
- package/expansion/_expansion-mixins.import.scss +1 -0
- package/expansion/_expansion-theme.import.scss +6 -0
- package/expansion/_expansion-variables.import.scss +1 -0
- package/fesm2015/autocomplete.js.map +1 -1
- package/fesm2015/bottom-sheet.js +11 -3
- package/fesm2015/bottom-sheet.js.map +1 -1
- package/fesm2015/core.js +3 -3
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/form-field/testing.js +69 -77
- package/fesm2015/form-field/testing.js.map +1 -1
- package/fesm2015/select.js +1 -1
- package/fesm2015/select.js.map +1 -1
- package/form-field/_form-field-fill-theme.import.scss +5 -0
- package/form-field/_form-field-legacy-theme.import.scss +5 -0
- package/form-field/_form-field-outline-theme.import.scss +5 -0
- package/form-field/_form-field-standard-theme.import.scss +5 -0
- package/form-field/_form-field-theme.import.scss +9 -0
- package/form-field/testing/form-field-harness.d.ts +47 -32
- package/grid-list/_grid-list-theme.import.scss +5 -0
- package/icon/_icon-theme.import.scss +2 -0
- package/input/_input-theme.import.scss +6 -0
- package/list/_list-theme.import.scss +5 -0
- package/menu/_menu-theme.import.scss +4 -0
- package/package.json +2 -2
- package/paginator/_paginator-theme.import.scss +5 -0
- package/paginator/_paginator-variables.import.scss +1 -0
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/progress-bar/_progress-bar-theme.import.scss +3 -0
- package/progress-spinner/_progress-spinner-theme.import.scss +3 -0
- package/radio/_radio-theme.import.scss +4 -0
- package/schematics/ng-add/index.js +1 -1
- package/select/_select-theme.import.scss +5 -0
- package/select/select.d.ts +1 -1
- package/sidenav/_sidenav-theme.import.scss +3 -0
- package/slide-toggle/_slide-toggle-theme.import.scss +4 -0
- package/slider/_slider-theme.import.scss +4 -0
- package/snack-bar/_snack-bar-theme.import.scss +4 -0
- package/sort/_sort-theme.import.scss +2 -0
- package/stepper/_stepper-theme.import.scss +5 -0
- package/stepper/_stepper-variables.import.scss +1 -0
- package/table/_table-flex-styles.import.scss +1 -0
- package/table/_table-flex-styles.scss +72 -0
- package/table/_table-theme.import.scss +4 -0
- package/tabs/_tabs-common.import.scss +4 -0
- package/tabs/_tabs-theme.import.scss +4 -0
- package/toolbar/_toolbar-theme.import.scss +6 -0
- package/toolbar/_toolbar-variables.import.scss +1 -0
- package/tooltip/_tooltip-theme.import.scss +4 -0
- package/tree/_tree-theme.import.scss +4 -0
- package/tree/_tree-variables.import.scss +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@angular/material/form-field/testing/control';
|
|
2
2
|
import { __awaiter } from 'tslib';
|
|
3
|
-
import { ComponentHarness,
|
|
3
|
+
import { ComponentHarness, parallel, HarnessPredicate } from '@angular/cdk/testing';
|
|
4
4
|
import { MatInputHarness } from '@angular/material/input/testing';
|
|
5
5
|
import { MatSelectHarness } from '@angular/material/select/testing';
|
|
6
6
|
|
|
@@ -11,68 +11,7 @@ import { MatSelectHarness } from '@angular/material/select/testing';
|
|
|
11
11
|
* Use of this source code is governed by an MIT-style license that can be
|
|
12
12
|
* found in the LICENSE file at https://angular.io/license
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
class MatFormFieldHarness extends ComponentHarness {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this._prefixContainer = this.locatorForOptional('.mat-form-field-prefix');
|
|
19
|
-
this._suffixContainer = this.locatorForOptional('.mat-form-field-suffix');
|
|
20
|
-
this._label = this.locatorForOptional('.mat-form-field-label');
|
|
21
|
-
this._errors = this.locatorForAll('.mat-error');
|
|
22
|
-
this._hints = this.locatorForAll('mat-hint, .mat-hint');
|
|
23
|
-
this._inputControl = this.locatorForOptional(MatInputHarness);
|
|
24
|
-
this._selectControl = this.locatorForOptional(MatSelectHarness);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Gets a `HarnessPredicate` that can be used to search for a `MatFormFieldHarness` that meets
|
|
28
|
-
* certain criteria.
|
|
29
|
-
* @param options Options for filtering which form field instances are considered a match.
|
|
30
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
31
|
-
*/
|
|
32
|
-
static with(options = {}) {
|
|
33
|
-
return new HarnessPredicate(MatFormFieldHarness, options)
|
|
34
|
-
.addOption('floatingLabelText', options.floatingLabelText, (harness, text) => __awaiter(this, void 0, void 0, function* () { return HarnessPredicate.stringMatches(yield harness.getLabel(), text); }))
|
|
35
|
-
.addOption('hasErrors', options.hasErrors, (harness, hasErrors) => __awaiter(this, void 0, void 0, function* () { return (yield harness.hasErrors()) === hasErrors; }));
|
|
36
|
-
}
|
|
37
|
-
/** Gets the appearance of the form-field. */
|
|
38
|
-
getAppearance() {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const hostClasses = yield (yield this.host()).getAttribute('class');
|
|
41
|
-
if (hostClasses !== null) {
|
|
42
|
-
const appearanceMatch = hostClasses.match(/mat-form-field-appearance-(legacy|standard|fill|outline)(?:$| )/);
|
|
43
|
-
if (appearanceMatch) {
|
|
44
|
-
return appearanceMatch[1];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
throw Error('Could not determine appearance of form-field.');
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
// Implementation of the "getControl" method overload signatures.
|
|
51
|
-
getControl(type) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
if (type) {
|
|
54
|
-
return this.locatorForOptional(type)();
|
|
55
|
-
}
|
|
56
|
-
const hostEl = yield this.host();
|
|
57
|
-
const [isInput, isSelect] = yield parallel(() => [
|
|
58
|
-
hostEl.hasClass('mat-form-field-type-mat-input'),
|
|
59
|
-
hostEl.hasClass('mat-form-field-type-mat-select'),
|
|
60
|
-
]);
|
|
61
|
-
if (isInput) {
|
|
62
|
-
return this._inputControl();
|
|
63
|
-
}
|
|
64
|
-
else if (isSelect) {
|
|
65
|
-
return this._selectControl();
|
|
66
|
-
}
|
|
67
|
-
return null;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
/** Whether the form-field has a label. */
|
|
71
|
-
hasLabel() {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
return (yield this.host()).hasClass('mat-form-field-has-label');
|
|
74
|
-
});
|
|
75
|
-
}
|
|
14
|
+
class _MatFormFieldHarnessBase extends ComponentHarness {
|
|
76
15
|
/** Gets the label of the form-field. */
|
|
77
16
|
getLabel() {
|
|
78
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -86,19 +25,6 @@ class MatFormFieldHarness extends ComponentHarness {
|
|
|
86
25
|
return (yield this.getTextErrors()).length > 0;
|
|
87
26
|
});
|
|
88
27
|
}
|
|
89
|
-
/** Whether the label is currently floating. */
|
|
90
|
-
isLabelFloating() {
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const host = yield this.host();
|
|
93
|
-
const [hasLabel, shouldFloat] = yield parallel(() => [
|
|
94
|
-
this.hasLabel(),
|
|
95
|
-
host.hasClass('mat-form-field-should-float'),
|
|
96
|
-
]);
|
|
97
|
-
// If there is no label, the label conceptually can never float. The `should-float` class
|
|
98
|
-
// is just always set regardless of whether the label is displayed or not.
|
|
99
|
-
return hasLabel && shouldFloat;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
28
|
/** Whether the form-field is disabled. */
|
|
103
29
|
isDisabled() {
|
|
104
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -111,6 +37,16 @@ class MatFormFieldHarness extends ComponentHarness {
|
|
|
111
37
|
return (yield this.host()).hasClass('mat-form-field-autofilled');
|
|
112
38
|
});
|
|
113
39
|
}
|
|
40
|
+
// Implementation of the "getControl" method overload signatures.
|
|
41
|
+
getControl(type) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
if (type) {
|
|
44
|
+
return this.locatorForOptional(type)();
|
|
45
|
+
}
|
|
46
|
+
const [select, input] = yield parallel(() => [this._selectControl(), this._inputControl()]);
|
|
47
|
+
return select || input;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
114
50
|
/** Gets the theme color of the form-field. */
|
|
115
51
|
getThemeColor() {
|
|
116
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -237,6 +173,62 @@ class MatFormFieldHarness extends ComponentHarness {
|
|
|
237
173
|
});
|
|
238
174
|
}
|
|
239
175
|
}
|
|
176
|
+
/** Harness for interacting with a standard Material form-field's in tests. */
|
|
177
|
+
class MatFormFieldHarness extends _MatFormFieldHarnessBase {
|
|
178
|
+
constructor() {
|
|
179
|
+
super(...arguments);
|
|
180
|
+
this._prefixContainer = this.locatorForOptional('.mat-form-field-prefix');
|
|
181
|
+
this._suffixContainer = this.locatorForOptional('.mat-form-field-suffix');
|
|
182
|
+
this._label = this.locatorForOptional('.mat-form-field-label');
|
|
183
|
+
this._errors = this.locatorForAll('.mat-error');
|
|
184
|
+
this._hints = this.locatorForAll('mat-hint, .mat-hint');
|
|
185
|
+
this._inputControl = this.locatorForOptional(MatInputHarness);
|
|
186
|
+
this._selectControl = this.locatorForOptional(MatSelectHarness);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Gets a `HarnessPredicate` that can be used to search for a `MatFormFieldHarness` that meets
|
|
190
|
+
* certain criteria.
|
|
191
|
+
* @param options Options for filtering which form field instances are considered a match.
|
|
192
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
193
|
+
*/
|
|
194
|
+
static with(options = {}) {
|
|
195
|
+
return new HarnessPredicate(MatFormFieldHarness, options)
|
|
196
|
+
.addOption('floatingLabelText', options.floatingLabelText, (harness, text) => __awaiter(this, void 0, void 0, function* () { return HarnessPredicate.stringMatches(yield harness.getLabel(), text); }))
|
|
197
|
+
.addOption('hasErrors', options.hasErrors, (harness, hasErrors) => __awaiter(this, void 0, void 0, function* () { return (yield harness.hasErrors()) === hasErrors; }));
|
|
198
|
+
}
|
|
199
|
+
/** Gets the appearance of the form-field. */
|
|
200
|
+
getAppearance() {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
const hostClasses = yield (yield this.host()).getAttribute('class');
|
|
203
|
+
if (hostClasses !== null) {
|
|
204
|
+
const appearanceMatch = hostClasses.match(/mat-form-field-appearance-(legacy|standard|fill|outline)(?:$| )/);
|
|
205
|
+
if (appearanceMatch) {
|
|
206
|
+
return appearanceMatch[1];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
throw Error('Could not determine appearance of form-field.');
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
/** Whether the form-field has a label. */
|
|
213
|
+
hasLabel() {
|
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
+
return (yield this.host()).hasClass('mat-form-field-has-label');
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/** Whether the label is currently floating. */
|
|
219
|
+
isLabelFloating() {
|
|
220
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
221
|
+
const host = yield this.host();
|
|
222
|
+
const [hasLabel, shouldFloat] = yield parallel(() => [
|
|
223
|
+
this.hasLabel(),
|
|
224
|
+
host.hasClass('mat-form-field-should-float'),
|
|
225
|
+
]);
|
|
226
|
+
// If there is no label, the label conceptually can never float. The `should-float` class
|
|
227
|
+
// is just always set regardless of whether the label is displayed or not.
|
|
228
|
+
return hasLabel && shouldFloat;
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
240
232
|
MatFormFieldHarness.hostSelector = '.mat-form-field';
|
|
241
233
|
|
|
242
234
|
/**
|
|
@@ -263,5 +255,5 @@ MatFormFieldHarness.hostSelector = '.mat-form-field';
|
|
|
263
255
|
* found in the LICENSE file at https://angular.io/license
|
|
264
256
|
*/
|
|
265
257
|
|
|
266
|
-
export { MatFormFieldHarness };
|
|
258
|
+
export { MatFormFieldHarness, _MatFormFieldHarnessBase };
|
|
267
259
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field__testing.js","sources":["../../../../../../src/material/form-field/testing/form-field-harness.ts","../../../../../../src/material/form-field/testing/form-field-harness-filters.ts","../../../../../../src/material/form-field/testing/public-api.ts","../../../../../../src/material/form-field/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n HarnessQuery,\n parallel,\n TestElement\n} from '@angular/cdk/testing';\nimport {MatFormFieldControlHarness} from '@angular/material/form-field/testing/control';\nimport {MatInputHarness} from '@angular/material/input/testing';\nimport {MatSelectHarness} from '@angular/material/select/testing';\nimport {FormFieldHarnessFilters} from './form-field-harness-filters';\n\n// TODO(devversion): support datepicker harness once developed (COMP-203).\n// Also support chip list harness.\n/** Possible harnesses of controls which can be bound to a form-field. */\nexport type FormFieldControlHarness = MatInputHarness|MatSelectHarness;\n\n/** Harness for interacting with a standard Material form-field's in tests. */\nexport class MatFormFieldHarness extends ComponentHarness {\n static hostSelector = '.mat-form-field';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatFormFieldHarness` that meets\n * certain criteria.\n * @param options Options for filtering which form field instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: FormFieldHarnessFilters = {}): HarnessPredicate<MatFormFieldHarness> {\n return new HarnessPredicate(MatFormFieldHarness, options)\n .addOption('floatingLabelText', options.floatingLabelText, async (harness, text) =>\n HarnessPredicate.stringMatches(await harness.getLabel(), text))\n .addOption('hasErrors', options.hasErrors, async (harness, hasErrors) =>\n await harness.hasErrors() === hasErrors);\n }\n\n private _prefixContainer = this.locatorForOptional('.mat-form-field-prefix');\n private _suffixContainer = this.locatorForOptional('.mat-form-field-suffix');\n private _label = this.locatorForOptional('.mat-form-field-label');\n private _errors = this.locatorForAll('.mat-error');\n private _hints = this.locatorForAll('mat-hint, .mat-hint');\n\n private _inputControl = this.locatorForOptional(MatInputHarness);\n private _selectControl = this.locatorForOptional(MatSelectHarness);\n\n /** Gets the appearance of the form-field. */\n async getAppearance(): Promise<'legacy'|'standard'|'fill'|'outline'> {\n const hostClasses = await (await this.host()).getAttribute('class');\n if (hostClasses !== null) {\n const appearanceMatch =\n hostClasses.match(/mat-form-field-appearance-(legacy|standard|fill|outline)(?:$| )/);\n if (appearanceMatch) {\n return appearanceMatch[1] as 'legacy' | 'standard' | 'fill' | 'outline';\n }\n }\n throw Error('Could not determine appearance of form-field.');\n }\n\n /**\n * Gets the harness of the control that is bound to the form-field. Only\n * default controls such as \"MatInputHarness\" and \"MatSelectHarness\" are\n * supported.\n */\n async getControl(): Promise<FormFieldControlHarness|null>;\n\n /**\n * Gets the harness of the control that is bound to the form-field. Searches\n * for a control that matches the specified harness type.\n */\n async getControl<X extends MatFormFieldControlHarness>(type: ComponentHarnessConstructor<X>):\n Promise<X|null>;\n\n /**\n * Gets the harness of the control that is bound to the form-field. Searches\n * for a control that matches the specified harness predicate.\n */\n async getControl<X extends MatFormFieldControlHarness>(type: HarnessPredicate<X>):\n Promise<X|null>;\n\n // Implementation of the \"getControl\" method overload signatures.\n async getControl<X extends MatFormFieldControlHarness>(type?: HarnessQuery<X>) {\n if (type) {\n return this.locatorForOptional(type)();\n }\n const hostEl = await this.host();\n const [isInput, isSelect] = await parallel(() => [\n hostEl.hasClass('mat-form-field-type-mat-input'),\n hostEl.hasClass('mat-form-field-type-mat-select'),\n ]);\n if (isInput) {\n return this._inputControl();\n } else if (isSelect) {\n return this._selectControl();\n }\n return null;\n }\n\n /** Whether the form-field has a label. */\n async hasLabel(): Promise<boolean> {\n return (await this.host()).hasClass('mat-form-field-has-label');\n }\n\n /** Gets the label of the form-field. */\n async getLabel(): Promise<string|null> {\n const labelEl = await this._label();\n return labelEl ? labelEl.text() : null;\n }\n\n /** Whether the form-field has errors. */\n async hasErrors(): Promise<boolean> {\n return (await this.getTextErrors()).length > 0;\n }\n\n /** Whether the label is currently floating. */\n async isLabelFloating(): Promise<boolean> {\n const host = await this.host();\n const [hasLabel, shouldFloat] = await parallel(() => [\n this.hasLabel(),\n host.hasClass('mat-form-field-should-float'),\n ]);\n // If there is no label, the label conceptually can never float. The `should-float` class\n // is just always set regardless of whether the label is displayed or not.\n return hasLabel && shouldFloat;\n }\n\n /** Whether the form-field is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('mat-form-field-disabled');\n }\n\n /** Whether the form-field is currently autofilled. */\n async isAutofilled(): Promise<boolean> {\n return (await this.host()).hasClass('mat-form-field-autofilled');\n }\n\n /** Gets the theme color of the form-field. */\n async getThemeColor(): Promise<'primary'|'accent'|'warn'> {\n const hostEl = await this.host();\n const [isAccent, isWarn] = await parallel(() => {\n return [hostEl.hasClass('mat-accent'), hostEl.hasClass('mat-warn')];\n });\n if (isAccent) {\n return 'accent';\n } else if (isWarn) {\n return 'warn';\n }\n return 'primary';\n }\n\n /** Gets error messages which are currently displayed in the form-field. */\n async getTextErrors(): Promise<string[]> {\n const errors = await this._errors();\n return parallel(() => errors.map(e => e.text()));\n }\n\n /** Gets hint messages which are currently displayed in the form-field. */\n async getTextHints(): Promise<string[]> {\n const hints = await this._hints();\n return parallel(() => hints.map(e => e.text()));\n }\n\n /**\n * Gets a reference to the container element which contains all projected\n * prefixes of the form-field.\n * @deprecated Use `getPrefixText` instead.\n * @breaking-change 11.0.0\n */\n async getHarnessLoaderForPrefix(): Promise<TestElement|null> {\n return this._prefixContainer();\n }\n\n /** Gets the text inside the prefix element. */\n async getPrefixText(): Promise<string> {\n const prefix = await this._prefixContainer();\n return prefix ? prefix.text() : '';\n }\n\n /**\n * Gets a reference to the container element which contains all projected\n * suffixes of the form-field.\n * @deprecated Use `getSuffixText` instead.\n * @breaking-change 11.0.0\n */\n async getHarnessLoaderForSuffix(): Promise<TestElement|null> {\n return this._suffixContainer();\n }\n\n /** Gets the text inside the suffix element. */\n async getSuffixText(): Promise<string> {\n const suffix = await this._suffixContainer();\n return suffix ? suffix.text() : '';\n }\n\n /**\n * Whether the form control has been touched. Returns \"null\"\n * if no form control is set up.\n */\n async isControlTouched(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-touched');\n }\n\n /**\n * Whether the form control is dirty. Returns \"null\"\n * if no form control is set up.\n */\n async isControlDirty(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-dirty');\n }\n\n /**\n * Whether the form control is valid. Returns \"null\"\n * if no form control is set up.\n */\n async isControlValid(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-valid');\n }\n\n /**\n * Whether the form control is pending validation. Returns \"null\"\n * if no form control is set up.\n */\n async isControlPending(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-pending');\n }\n\n /** Checks whether the form-field control has set up a form control. */\n private async _hasFormControl(): Promise<boolean> {\n const hostEl = await this.host();\n // If no form \"NgControl\" is bound to the form-field control, the form-field\n // is not able to forward any control status classes. Therefore if either the\n // \"ng-touched\" or \"ng-untouched\" class is set, we know that it has a form control\n const [isTouched, isUntouched] =\n await parallel(() => [hostEl.hasClass('ng-touched'), hostEl.hasClass('ng-untouched')]);\n return isTouched || isUntouched;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** A set of criteria that can be used to filter a list of `MatFormFieldHarness` instances. */\nexport interface FormFieldHarnessFilters extends BaseHarnessFilters {\n /** Filters based on the text of the form field's floating label. */\n floatingLabelText?: string | RegExp;\n /** Filters based on whether the form field has error messages. */\n hasErrors?: boolean;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// Re-export everything from the \"form-field/testing/control\" entry-point. To avoid\n// circular dependencies, harnesses for default form-field controls (i.e. input, select)\n// need to import the base form-field control harness through a separate entry-point.\nexport * from '@angular/material/form-field/testing/control';\n\nexport * from './form-field-harness';\nexport * from './form-field-harness-filters';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api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AAC;SACnD;KAAA;;IAGa,eAAe;;YAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;;;;YAIjC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,GAC1B,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAC3F,OAAO,SAAS,IAAI,WAAW,CAAC;SACjC;KAAA;;AAlOM,gCAAY,GAAG,iBAAiB,CAAC;;AC5B1C;;;;;;GAMG;;ACNH;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
|
|
1
|
+
{"version":3,"file":"form-field__testing.js","sources":["../../../../../../src/material/form-field/testing/form-field-harness.ts","../../../../../../src/material/form-field/testing/form-field-harness-filters.ts","../../../../../../src/material/form-field/testing/public-api.ts","../../../../../../src/material/form-field/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n AsyncFactoryFn,\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n HarnessQuery,\n parallel,\n TestElement\n} from '@angular/cdk/testing';\nimport {MatFormFieldControlHarness} from '@angular/material/form-field/testing/control';\nimport {MatInputHarness} from '@angular/material/input/testing';\nimport {MatSelectHarness} from '@angular/material/select/testing';\nimport {FormFieldHarnessFilters} from './form-field-harness-filters';\n\n// TODO(devversion): support datepicker harness once developed (COMP-203).\n// Also support chip list harness.\n/** Possible harnesses of controls which can be bound to a form-field. */\nexport type FormFieldControlHarness = MatInputHarness|MatSelectHarness;\n\nexport abstract class _MatFormFieldHarnessBase<ControlHarness extends MatFormFieldControlHarness>\n extends ComponentHarness {\n protected abstract _prefixContainer: AsyncFactoryFn<TestElement|null>;\n protected abstract _suffixContainer: AsyncFactoryFn<TestElement|null>;\n protected abstract _label: AsyncFactoryFn<TestElement|null>;\n protected abstract _errors: AsyncFactoryFn<TestElement[]>;\n protected abstract _hints: AsyncFactoryFn<TestElement[]>;\n protected abstract _inputControl: AsyncFactoryFn<ControlHarness|null>;\n protected abstract _selectControl: AsyncFactoryFn<ControlHarness|null>;\n\n /** Gets the appearance of the form-field. */\n abstract getAppearance(): Promise<string>;\n\n /** Whether the label is currently floating. */\n abstract isLabelFloating(): Promise<boolean>;\n\n /** Whether the form-field has a label. */\n abstract hasLabel(): Promise<boolean>;\n\n /** Gets the label of the form-field. */\n async getLabel(): Promise<string|null> {\n const labelEl = await this._label();\n return labelEl ? labelEl.text() : null;\n }\n\n /** Whether the form-field has errors. */\n async hasErrors(): Promise<boolean> {\n return (await this.getTextErrors()).length > 0;\n }\n\n /** Whether the form-field is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await this.host()).hasClass('mat-form-field-disabled');\n }\n\n /** Whether the form-field is currently autofilled. */\n async isAutofilled(): Promise<boolean> {\n return (await this.host()).hasClass('mat-form-field-autofilled');\n }\n\n /**\n * Gets the harness of the control that is bound to the form-field. Only\n * default controls such as \"MatInputHarness\" and \"MatSelectHarness\" are\n * supported.\n */\n async getControl(): Promise<ControlHarness|null>;\n\n /**\n * Gets the harness of the control that is bound to the form-field. Searches\n * for a control that matches the specified harness type.\n */\n async getControl<X extends MatFormFieldControlHarness>(type: ComponentHarnessConstructor<X>):\n Promise<X|null>;\n\n /**\n * Gets the harness of the control that is bound to the form-field. Searches\n * for a control that matches the specified harness predicate.\n */\n async getControl<X extends MatFormFieldControlHarness>(type: HarnessPredicate<X>):\n Promise<X|null>;\n\n // Implementation of the \"getControl\" method overload signatures.\n async getControl<X extends MatFormFieldControlHarness>(type?: HarnessQuery<X>) {\n if (type) {\n return this.locatorForOptional(type)();\n }\n const [select, input] = await parallel(() => [this._selectControl(), this._inputControl()]);\n return select || input;\n }\n\n /** Gets the theme color of the form-field. */\n async getThemeColor(): Promise<'primary'|'accent'|'warn'> {\n const hostEl = await this.host();\n const [isAccent, isWarn] = await parallel(() => {\n return [hostEl.hasClass('mat-accent'), hostEl.hasClass('mat-warn')];\n });\n if (isAccent) {\n return 'accent';\n } else if (isWarn) {\n return 'warn';\n }\n return 'primary';\n }\n\n /** Gets error messages which are currently displayed in the form-field. */\n async getTextErrors(): Promise<string[]> {\n const errors = await this._errors();\n return parallel(() => errors.map(e => e.text()));\n }\n\n /** Gets hint messages which are currently displayed in the form-field. */\n async getTextHints(): Promise<string[]> {\n const hints = await this._hints();\n return parallel(() => hints.map(e => e.text()));\n }\n\n /**\n * Gets a reference to the container element which contains all projected\n * prefixes of the form-field.\n * @deprecated Use `getPrefixText` instead.\n * @breaking-change 11.0.0\n */\n async getHarnessLoaderForPrefix(): Promise<TestElement|null> {\n return this._prefixContainer();\n }\n\n /** Gets the text inside the prefix element. */\n async getPrefixText(): Promise<string> {\n const prefix = await this._prefixContainer();\n return prefix ? prefix.text() : '';\n }\n\n /**\n * Gets a reference to the container element which contains all projected\n * suffixes of the form-field.\n * @deprecated Use `getSuffixText` instead.\n * @breaking-change 11.0.0\n */\n async getHarnessLoaderForSuffix(): Promise<TestElement|null> {\n return this._suffixContainer();\n }\n\n /** Gets the text inside the suffix element. */\n async getSuffixText(): Promise<string> {\n const suffix = await this._suffixContainer();\n return suffix ? suffix.text() : '';\n }\n\n /**\n * Whether the form control has been touched. Returns \"null\"\n * if no form control is set up.\n */\n async isControlTouched(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-touched');\n }\n\n /**\n * Whether the form control is dirty. Returns \"null\"\n * if no form control is set up.\n */\n async isControlDirty(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-dirty');\n }\n\n /**\n * Whether the form control is valid. Returns \"null\"\n * if no form control is set up.\n */\n async isControlValid(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-valid');\n }\n\n /**\n * Whether the form control is pending validation. Returns \"null\"\n * if no form control is set up.\n */\n async isControlPending(): Promise<boolean|null> {\n if (!await this._hasFormControl()) {\n return null;\n }\n return (await this.host()).hasClass('ng-pending');\n }\n\n /** Checks whether the form-field control has set up a form control. */\n private async _hasFormControl(): Promise<boolean> {\n const hostEl = await this.host();\n // If no form \"NgControl\" is bound to the form-field control, the form-field\n // is not able to forward any control status classes. Therefore if either the\n // \"ng-touched\" or \"ng-untouched\" class is set, we know that it has a form control\n const [isTouched, isUntouched] =\n await parallel(() => [hostEl.hasClass('ng-touched'), hostEl.hasClass('ng-untouched')]);\n return isTouched || isUntouched;\n }\n}\n\n/** Harness for interacting with a standard Material form-field's in tests. */\nexport class MatFormFieldHarness extends _MatFormFieldHarnessBase<FormFieldControlHarness> {\n static hostSelector = '.mat-form-field';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatFormFieldHarness` that meets\n * certain criteria.\n * @param options Options for filtering which form field instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: FormFieldHarnessFilters = {}): HarnessPredicate<MatFormFieldHarness> {\n return new HarnessPredicate(MatFormFieldHarness, options)\n .addOption('floatingLabelText', options.floatingLabelText, async (harness, text) =>\n HarnessPredicate.stringMatches(await harness.getLabel(), text))\n .addOption('hasErrors', options.hasErrors, async (harness, hasErrors) =>\n await harness.hasErrors() === hasErrors);\n }\n\n protected _prefixContainer = this.locatorForOptional('.mat-form-field-prefix');\n protected _suffixContainer = this.locatorForOptional('.mat-form-field-suffix');\n protected _label = this.locatorForOptional('.mat-form-field-label');\n protected _errors = this.locatorForAll('.mat-error');\n protected _hints = this.locatorForAll('mat-hint, .mat-hint');\n protected _inputControl = this.locatorForOptional(MatInputHarness);\n protected _selectControl = this.locatorForOptional(MatSelectHarness);\n\n /** Gets the appearance of the form-field. */\n async getAppearance(): Promise<'legacy'|'standard'|'fill'|'outline'> {\n const hostClasses = await (await this.host()).getAttribute('class');\n if (hostClasses !== null) {\n const appearanceMatch =\n hostClasses.match(/mat-form-field-appearance-(legacy|standard|fill|outline)(?:$| )/);\n if (appearanceMatch) {\n return appearanceMatch[1] as 'legacy' | 'standard' | 'fill' | 'outline';\n }\n }\n throw Error('Could not determine appearance of form-field.');\n }\n\n /** Whether the form-field has a label. */\n async hasLabel(): Promise<boolean> {\n return (await this.host()).hasClass('mat-form-field-has-label');\n }\n\n /** Whether the label is currently floating. */\n async isLabelFloating(): Promise<boolean> {\n const host = await this.host();\n const [hasLabel, shouldFloat] = await parallel(() => [\n this.hasLabel(),\n host.hasClass('mat-form-field-should-float'),\n ]);\n // If there is no label, the label conceptually can never float. The `should-float` class\n // is just always set regardless of whether the label is displayed or not.\n return hasLabel && shouldFloat;\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {BaseHarnessFilters} from '@angular/cdk/testing';\n\n/** A set of criteria that can be used to filter a list of `MatFormFieldHarness` instances. */\nexport interface FormFieldHarnessFilters extends BaseHarnessFilters {\n /** Filters based on the text of the form field's floating label. */\n floatingLabelText?: string | RegExp;\n /** Filters based on whether the form field has error messages. */\n hasErrors?: boolean;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// Re-export everything from the \"form-field/testing/control\" entry-point. To avoid\n// circular dependencies, harnesses for default form-field controls (i.e. input, select)\n// need to import the base form-field control harness through a separate entry-point.\nexport * from '@angular/material/form-field/testing/control';\n\nexport * from './form-field-harness';\nexport * from './form-field-harness-filters';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;MA2BsB,wBACpB,SAAQ,gBAAgB;;IAmBl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;;YAGH,OAAO,QAAQ,IAAI,WAAW,CAAC;SAChC;KAAA;;AApDM,gCAAY,GAAG,iBAAiB,CAAC;;ACrN1C;;;;;;GAMG;;ACNH;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
|
package/fesm2015/select.js
CHANGED
|
@@ -251,7 +251,7 @@ class _MatSelectBase extends _MatSelectMixinBase {
|
|
|
251
251
|
this._required = false;
|
|
252
252
|
this._multiple = false;
|
|
253
253
|
this._disableOptionCentering = (_c = (_b = this._defaultOptions) === null || _b === void 0 ? void 0 : _b.disableOptionCentering) !== null && _c !== void 0 ? _c : false;
|
|
254
|
-
/** Aria label of the select.
|
|
254
|
+
/** Aria label of the select. */
|
|
255
255
|
this.ariaLabel = '';
|
|
256
256
|
/** Combined stream of all of the child options' change events. */
|
|
257
257
|
this.optionSelectionChanges = defer(() => {
|