@angular/material 21.0.0-next.9 → 21.0.0-rc.0
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 +810 -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
|
@@ -4,89 +4,65 @@ import { MatSelectHarness } from './select-testing.mjs';
|
|
|
4
4
|
import '@angular/material/core/testing';
|
|
5
5
|
import '@angular/material/form-field/testing/control';
|
|
6
6
|
|
|
7
|
-
/** Harness for interacting with a mat-paginator in tests. */
|
|
8
7
|
class MatPaginatorHarness extends ComponentHarness {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
static hostSelector = '.mat-mdc-paginator';
|
|
9
|
+
_nextButton = this.locatorFor('.mat-mdc-paginator-navigation-next');
|
|
10
|
+
_previousButton = this.locatorFor('.mat-mdc-paginator-navigation-previous');
|
|
11
|
+
_firstPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-first');
|
|
12
|
+
_lastPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-last');
|
|
13
|
+
_select = this.locatorForOptional(MatSelectHarness.with({
|
|
14
|
+
ancestor: '.mat-mdc-paginator-page-size'
|
|
15
|
+
}));
|
|
16
|
+
_pageSizeFallback = this.locatorFor('.mat-mdc-paginator-page-size-value');
|
|
17
|
+
_rangeLabel = this.locatorFor('.mat-mdc-paginator-range-label');
|
|
18
|
+
static with(options = {}) {
|
|
19
|
+
return new HarnessPredicate(this, options);
|
|
20
|
+
}
|
|
21
|
+
async goToNextPage() {
|
|
22
|
+
return (await this._nextButton()).click();
|
|
23
|
+
}
|
|
24
|
+
async isNextPageDisabled() {
|
|
25
|
+
const disabledValue = await (await this._nextButton()).getAttribute('aria-disabled');
|
|
26
|
+
return disabledValue == 'true';
|
|
27
|
+
}
|
|
28
|
+
async isPreviousPageDisabled() {
|
|
29
|
+
const disabledValue = await (await this._previousButton()).getAttribute('aria-disabled');
|
|
30
|
+
return disabledValue == 'true';
|
|
31
|
+
}
|
|
32
|
+
async goToPreviousPage() {
|
|
33
|
+
return (await this._previousButton()).click();
|
|
34
|
+
}
|
|
35
|
+
async goToFirstPage() {
|
|
36
|
+
const button = await this._firstPageButton();
|
|
37
|
+
if (!button) {
|
|
38
|
+
throw Error('Could not find first page button inside paginator. ' + 'Make sure that `showFirstLastButtons` is enabled.');
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
return button.click();
|
|
41
|
+
}
|
|
42
|
+
async goToLastPage() {
|
|
43
|
+
const button = await this._lastPageButton();
|
|
44
|
+
if (!button) {
|
|
45
|
+
throw Error('Could not find last page button inside paginator. ' + 'Make sure that `showFirstLastButtons` is enabled.');
|
|
31
46
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
async isPreviousPageDisabled() {
|
|
39
|
-
const disabledValue = await (await this._previousButton()).getAttribute('aria-disabled');
|
|
40
|
-
return disabledValue == 'true';
|
|
41
|
-
}
|
|
42
|
-
/** Goes to the previous page in the paginator. */
|
|
43
|
-
async goToPreviousPage() {
|
|
44
|
-
return (await this._previousButton()).click();
|
|
45
|
-
}
|
|
46
|
-
/** Goes to the first page in the paginator. */
|
|
47
|
-
async goToFirstPage() {
|
|
48
|
-
const button = await this._firstPageButton();
|
|
49
|
-
// The first page button isn't enabled by default so we need to check for it.
|
|
50
|
-
if (!button) {
|
|
51
|
-
throw Error('Could not find first page button inside paginator. ' +
|
|
52
|
-
'Make sure that `showFirstLastButtons` is enabled.');
|
|
53
|
-
}
|
|
54
|
-
return button.click();
|
|
55
|
-
}
|
|
56
|
-
/** Goes to the last page in the paginator. */
|
|
57
|
-
async goToLastPage() {
|
|
58
|
-
const button = await this._lastPageButton();
|
|
59
|
-
// The last page button isn't enabled by default so we need to check for it.
|
|
60
|
-
if (!button) {
|
|
61
|
-
throw Error('Could not find last page button inside paginator. ' +
|
|
62
|
-
'Make sure that `showFirstLastButtons` is enabled.');
|
|
63
|
-
}
|
|
64
|
-
return button.click();
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Sets the page size of the paginator.
|
|
68
|
-
* @param size Page size that should be select.
|
|
69
|
-
*/
|
|
70
|
-
async setPageSize(size) {
|
|
71
|
-
const select = await this._select();
|
|
72
|
-
// The select is only available if the `pageSizeOptions` are
|
|
73
|
-
// set to an array with more than one item.
|
|
74
|
-
if (!select) {
|
|
75
|
-
throw Error('Cannot find page size selector in paginator. ' +
|
|
76
|
-
'Make sure that the `pageSizeOptions` have been configured.');
|
|
77
|
-
}
|
|
78
|
-
return select.clickOptions({ text: `${size}` });
|
|
79
|
-
}
|
|
80
|
-
/** Gets the page size of the paginator. */
|
|
81
|
-
async getPageSize() {
|
|
82
|
-
const select = await this._select();
|
|
83
|
-
const value = select ? select.getValueText() : (await this._pageSizeFallback()).text();
|
|
84
|
-
return coerceNumberProperty(await value);
|
|
85
|
-
}
|
|
86
|
-
/** Gets the text of the range label of the paginator. */
|
|
87
|
-
async getRangeLabel() {
|
|
88
|
-
return (await this._rangeLabel()).text();
|
|
47
|
+
return button.click();
|
|
48
|
+
}
|
|
49
|
+
async setPageSize(size) {
|
|
50
|
+
const select = await this._select();
|
|
51
|
+
if (!select) {
|
|
52
|
+
throw Error('Cannot find page size selector in paginator. ' + 'Make sure that the `pageSizeOptions` have been configured.');
|
|
89
53
|
}
|
|
54
|
+
return select.clickOptions({
|
|
55
|
+
text: `${size}`
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async getPageSize() {
|
|
59
|
+
const select = await this._select();
|
|
60
|
+
const value = select ? select.getValueText() : (await this._pageSizeFallback()).text();
|
|
61
|
+
return coerceNumberProperty(await value);
|
|
62
|
+
}
|
|
63
|
+
async getRangeLabel() {
|
|
64
|
+
return (await this._rangeLabel()).text();
|
|
65
|
+
}
|
|
90
66
|
}
|
|
91
67
|
|
|
92
68
|
export { MatPaginatorHarness };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator-testing.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material/paginator/testing/paginator-harness.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.dev/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n} from '@angular/cdk/testing';\nimport {MatSelectHarness} from '../../select/testing';\nimport {coerceNumberProperty} from '@angular/cdk/coercion';\nimport {PaginatorHarnessFilters} from './paginator-harness-filters';\n\n/** Harness for interacting with a mat-paginator in tests. */\nexport class MatPaginatorHarness extends ComponentHarness {\n /** Selector used to find paginator instances. */\n static hostSelector = '.mat-mdc-paginator';\n private _nextButton = this.locatorFor('.mat-mdc-paginator-navigation-next');\n private _previousButton = this.locatorFor('.mat-mdc-paginator-navigation-previous');\n private _firstPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-first');\n private _lastPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-last');\n _select = this.locatorForOptional(\n MatSelectHarness.with({\n ancestor: '.mat-mdc-paginator-page-size',\n }),\n );\n private _pageSizeFallback = this.locatorFor('.mat-mdc-paginator-page-size-value');\n _rangeLabel = this.locatorFor('.mat-mdc-paginator-range-label');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a paginator with specific attributes.\n * @param options Options for filtering which paginator instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatPaginatorHarness>(\n this: ComponentHarnessConstructor<T>,\n options: PaginatorHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options);\n }\n\n /** Goes to the next page in the paginator. */\n async goToNextPage(): Promise<void> {\n return (await this._nextButton()).click();\n }\n\n /** Returns whether or not the next page button is disabled. */\n async isNextPageDisabled(): Promise<boolean> {\n const disabledValue = await (await this._nextButton()).getAttribute('aria-disabled');\n return disabledValue == 'true';\n }\n\n /* Returns whether or not the previous page button is disabled. */\n async isPreviousPageDisabled(): Promise<boolean> {\n const disabledValue = await (await this._previousButton()).getAttribute('aria-disabled');\n return disabledValue == 'true';\n }\n\n /** Goes to the previous page in the paginator. */\n async goToPreviousPage(): Promise<void> {\n return (await this._previousButton()).click();\n }\n\n /** Goes to the first page in the paginator. */\n async goToFirstPage(): Promise<void> {\n const button = await this._firstPageButton();\n\n // The first page button isn't enabled by default so we need to check for it.\n if (!button) {\n throw Error(\n 'Could not find first page button inside paginator. ' +\n 'Make sure that `showFirstLastButtons` is enabled.',\n );\n }\n\n return button.click();\n }\n\n /** Goes to the last page in the paginator. */\n async goToLastPage(): Promise<void> {\n const button = await this._lastPageButton();\n\n // The last page button isn't enabled by default so we need to check for it.\n if (!button) {\n throw Error(\n 'Could not find last page button inside paginator. ' +\n 'Make sure that `showFirstLastButtons` is enabled.',\n );\n }\n\n return button.click();\n }\n\n /**\n * Sets the page size of the paginator.\n * @param size Page size that should be select.\n */\n async setPageSize(size: number): Promise<void> {\n const select = await this._select();\n\n // The select is only available if the `pageSizeOptions` are\n // set to an array with more than one item.\n if (!select) {\n throw Error(\n 'Cannot find page size selector in paginator. ' +\n 'Make sure that the `pageSizeOptions` have been configured.',\n );\n }\n\n return select.clickOptions({text: `${size}`});\n }\n\n /** Gets the page size of the paginator. */\n async getPageSize(): Promise<number> {\n const select = await this._select();\n const value = select ? select.getValueText() : (await this._pageSizeFallback()).text();\n return coerceNumberProperty(await value);\n }\n\n /** Gets the text of the range label of the paginator. */\n async getRangeLabel(): Promise<string> {\n return (await this._rangeLabel()).text();\n }\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"paginator-testing.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/material/paginator/testing/paginator-harness.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.dev/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n} from '@angular/cdk/testing';\nimport {MatSelectHarness} from '../../select/testing';\nimport {coerceNumberProperty} from '@angular/cdk/coercion';\nimport {PaginatorHarnessFilters} from './paginator-harness-filters';\n\n/** Harness for interacting with a mat-paginator in tests. */\nexport class MatPaginatorHarness extends ComponentHarness {\n /** Selector used to find paginator instances. */\n static hostSelector = '.mat-mdc-paginator';\n private _nextButton = this.locatorFor('.mat-mdc-paginator-navigation-next');\n private _previousButton = this.locatorFor('.mat-mdc-paginator-navigation-previous');\n private _firstPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-first');\n private _lastPageButton = this.locatorForOptional('.mat-mdc-paginator-navigation-last');\n _select = this.locatorForOptional(\n MatSelectHarness.with({\n ancestor: '.mat-mdc-paginator-page-size',\n }),\n );\n private _pageSizeFallback = this.locatorFor('.mat-mdc-paginator-page-size-value');\n _rangeLabel = this.locatorFor('.mat-mdc-paginator-range-label');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a paginator with specific attributes.\n * @param options Options for filtering which paginator instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatPaginatorHarness>(\n this: ComponentHarnessConstructor<T>,\n options: PaginatorHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options);\n }\n\n /** Goes to the next page in the paginator. */\n async goToNextPage(): Promise<void> {\n return (await this._nextButton()).click();\n }\n\n /** Returns whether or not the next page button is disabled. */\n async isNextPageDisabled(): Promise<boolean> {\n const disabledValue = await (await this._nextButton()).getAttribute('aria-disabled');\n return disabledValue == 'true';\n }\n\n /* Returns whether or not the previous page button is disabled. */\n async isPreviousPageDisabled(): Promise<boolean> {\n const disabledValue = await (await this._previousButton()).getAttribute('aria-disabled');\n return disabledValue == 'true';\n }\n\n /** Goes to the previous page in the paginator. */\n async goToPreviousPage(): Promise<void> {\n return (await this._previousButton()).click();\n }\n\n /** Goes to the first page in the paginator. */\n async goToFirstPage(): Promise<void> {\n const button = await this._firstPageButton();\n\n // The first page button isn't enabled by default so we need to check for it.\n if (!button) {\n throw Error(\n 'Could not find first page button inside paginator. ' +\n 'Make sure that `showFirstLastButtons` is enabled.',\n );\n }\n\n return button.click();\n }\n\n /** Goes to the last page in the paginator. */\n async goToLastPage(): Promise<void> {\n const button = await this._lastPageButton();\n\n // The last page button isn't enabled by default so we need to check for it.\n if (!button) {\n throw Error(\n 'Could not find last page button inside paginator. ' +\n 'Make sure that `showFirstLastButtons` is enabled.',\n );\n }\n\n return button.click();\n }\n\n /**\n * Sets the page size of the paginator.\n * @param size Page size that should be select.\n */\n async setPageSize(size: number): Promise<void> {\n const select = await this._select();\n\n // The select is only available if the `pageSizeOptions` are\n // set to an array with more than one item.\n if (!select) {\n throw Error(\n 'Cannot find page size selector in paginator. ' +\n 'Make sure that the `pageSizeOptions` have been configured.',\n );\n }\n\n return select.clickOptions({text: `${size}`});\n }\n\n /** Gets the page size of the paginator. */\n async getPageSize(): Promise<number> {\n const select = await this._select();\n const value = select ? select.getValueText() : (await this._pageSizeFallback()).text();\n return coerceNumberProperty(await value);\n }\n\n /** Gets the text of the range label of the paginator. */\n async getRangeLabel(): Promise<string> {\n return (await this._rangeLabel()).text();\n }\n}\n"],"names":["hostSelector","_nextButton","locatorFor","_previousButton","_firstPageButton","locatorForOptional","_pageSizeFallback","_rangeLabel","with","options","HarnessPredicate","isNextPageDisabled","disabledValue","getAttribute","isPreviousPageDisabled","goToPreviousPage","goToFirstPage","button","click","goToLastPage","_lastPageButton","Error"],"mappings":";;;;;;;AAoBE,EAAA,OAAAA,YAAA,GAAA,oBAAA;EAEQC,WACA,GAAA,IAAA,CAAAC,WAIJ,oCAAA,CAAA;EACDC,eACF,GAAA,IAAA,CAAAD,UAAA,CAAA,wCAAA,CAAA;EACOE,gBAAA,GAAA,IAAA,CAAAC,mBAAoC,qCAAA,CAAA;;;;AAOzC,GAAA,CAAA,CAAA;EACGC,iBAEJ,GAAqC,IAAAJ,CAAAA,UAAA,CAAA,oCAAA,CAAA;EAErCK,WAAA,GAAA,IAA2B,CAAAL,UAAA,CAAO,gCAAA,CAAA;AAUlC,EAAA,OAAAM,IAAAC,CAAAA,OAAmB,GAAG,EAAM,EAAA;WACrB,IAAAC,gBAAiB,CAAA,IAAA,EAAAD,OAAA,CAAA;;;;;AAc1BE,EAAAA,MAAAA,kBAA+CA,GAAA;AAC/C,IAAA,MAAAC,aAAA,GAAA,MAAA,CAAA,MAAA,IAAA,CAAAX,WAAA,EAAA,EAAAY,YAAA,CAAA,eAAA,CAAA;;;AAOQ,EAAA,MAAAC,sBAAA,GAAA;AAIN,IAAA,MAAAF,aAAA,GAAA,MAAA,CAAA,MAAA,IAAA,CAAAT,eAAA,EAAA,EAAqBU,YAAA,CAAA,eAAA,CAAA;WACvBD,aAAA,IAAA,MAAA;;AAIE,EAAA,MAAAG,gBAAA,GAAA;;;qBAQAC,GAAA;IAEA,MAAAC,MAAA,cAAAb,gBAAA,EAAA;;0EAMC,mDAAA,CAAA;AAED;WAEAa,MAAA,CAAAC,KAA4D,EAAA;;AAKtDC,EAAAA,MAAAA,YAAAA,GAAA;gBAEN,GAAA,MAEA,IAAA,CAAAC,eAAA,EAAA;AAIF,IAAA,IAAA,CAAAH,MAAA,EAAA;YAEQI,KAAA,qDAAc,GACpB,mDAAA,CAAA;;IAIF,OAAAJ,MAAA,CAAmBC,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|