{"version":3,"file":"paginator__testing.js","sources":["../../../../../../src/material/paginator/testing/paginator-harness.ts","../../../../../../src/material/paginator/testing/paginator-harness-filters.ts","../../../../../../src/material/paginator/testing/public-api.ts","../../../../../../src/material/paginator/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 HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {MatSelectHarness} from '@angular/material/select/testing';\nimport {coerceNumberProperty} from '@angular/cdk/coercion';\nimport {PaginatorHarnessFilters} from './paginator-harness-filters';\n\nexport abstract class _MatPaginatorHarnessBase extends ComponentHarness {\n protected abstract _nextButton: AsyncFactoryFn;\n protected abstract _previousButton: AsyncFactoryFn;\n protected abstract _firstPageButton: AsyncFactoryFn;\n protected abstract _lastPageButton: AsyncFactoryFn;\n protected abstract _select: AsyncFactoryFn;\n clickOptions(...filters: unknown[]): Promise;\n } | null>;\n protected abstract _pageSizeFallback: AsyncFactoryFn;\n protected abstract _rangeLabel: AsyncFactoryFn;\n\n /** Goes to the next page in the paginator. */\n async goToNextPage(): Promise {\n return (await this._nextButton()).click();\n }\n\n /** Goes to the previous page in the paginator. */\n async goToPreviousPage(): Promise {\n return (await this._previousButton()).click();\n }\n\n /** Goes to the first page in the paginator. */\n async goToFirstPage(): Promise {\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('Could not find first page button inside paginator. ' +\n 'Make sure that `showFirstLastButtons` is enabled.');\n }\n\n return button.click();\n }\n\n /** Goes to the last page in the paginator. */\n async goToLastPage(): Promise {\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('Could not find last page button inside paginator. ' +\n 'Make sure that `showFirstLastButtons` is enabled.');\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 {\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('Cannot find page size selector in paginator. ' +\n 'Make sure that the `pageSizeOptions` have been configured.');\n }\n\n return select.clickOptions({text: `${size}`});\n }\n\n /** Gets the page size of the paginator. */\n async getPageSize(): Promise {\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 labe of the paginator. */\n async getRangeLabel(): Promise {\n return (await this._rangeLabel()).text();\n }\n}\n\n/** Harness for interacting with a standard mat-paginator in tests. */\nexport class MatPaginatorHarness extends _MatPaginatorHarnessBase {\n /** Selector used to find paginator instances. */\n static hostSelector = '.mat-paginator';\n protected _nextButton = this.locatorFor('.mat-paginator-navigation-next');\n protected _previousButton = this.locatorFor('.mat-paginator-navigation-previous');\n protected _firstPageButton = this.locatorForOptional('.mat-paginator-navigation-first');\n protected _lastPageButton = this.locatorForOptional('.mat-paginator-navigation-last');\n protected _select = this.locatorForOptional(MatSelectHarness.with({\n ancestor: '.mat-paginator-page-size'\n }));\n protected _pageSizeFallback = this.locatorFor('.mat-paginator-page-size-value');\n protected _rangeLabel = this.locatorFor('.mat-paginator-range-label');\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a `MatPaginatorHarness` that meets\n * certain criteria.\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(options: PaginatorHarnessFilters = {}): HarnessPredicate {\n return new HarnessPredicate(MatPaginatorHarness, options);\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 `MatPaginatorHarness` instances. */\nexport interface PaginatorHarnessFilters extends BaseHarnessFilters {\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\nexport * from './paginator-harness';\nexport * from './paginator-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;;;;;;;MAkBsB,wBAAyB,SAAQ,gBAAgB;;IAa/D,YAAY;;YAChB,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;SAC3C;KAAA;;IAGK,gBAAgB;;YACpB,OAAO,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC;SAC/C;KAAA;;IAGK,aAAa;;YACjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;;YAG7C,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,KAAK,CAAC,qDAAqD;oBACrD,mDAAmD,CAAC,CAAC;aAClE;YAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;SACvB;KAAA;;IAGK,YAAY;;YAChB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;;YAG5C,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,KAAK,CAAC,oDAAoD;oBACpD,mDAAmD,CAAC,CAAC;aAClE;YAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;SACvB;KAAA;;;;;IAMK,WAAW,CAAC,IAAY;;YAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;;;YAIpC,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,KAAK,CAAC,+CAA+C;oBAC/C,4DAA4D,CAAC,CAAC;aAC3E;YAED,OAAO,MAAM,CAAC,YAAY,CAAC,EAAC,IAAI,EAAE,GA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