{"version":3,"file":"testing.mjs","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<TestElement>;\n  protected abstract _previousButton: AsyncFactoryFn<TestElement>;\n  protected abstract _firstPageButton: AsyncFactoryFn<TestElement | null>;\n  protected abstract _lastPageButton: AsyncFactoryFn<TestElement | null>;\n  protected abstract _select: AsyncFactoryFn<ComponentHarness & {\n    getValueText(): Promise<string>;\n    clickOptions(...filters: unknown[]): Promise<void>;\n  } | null>;\n  protected abstract _pageSizeFallback: AsyncFactoryFn<TestElement>;\n  protected abstract _rangeLabel: AsyncFactoryFn<TestElement>;\n\n  /** Goes to the next page in the paginator. */\n  async goToNextPage(): Promise<void> {\n    return (await this._nextButton()).click();\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('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<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('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<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('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<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 labe of the paginator. */\n  async getRangeLabel(): Promise<string> {\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<MatPaginatorHarness> {\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;;IAarE,MAAM,YAAY;QAChB,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,CAAC;KAC3C;;IAGD,MAAM,gBAAgB;QACpB,OAAO,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,CAAC;KAC/C;;IAGD,MAAM,aAAa;QACjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;;QAG7C,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,KAAK,CAAC,qDAAqD;gBACrD,mDAAmD,CAAC,CAAC;SAClE;QAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;KACvB;;IAGD,MAAM,YAAY;QAChB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;;QAG5C,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,KAAK,CAAC,oDAAoD;gBACpD,mDAAmD,CAAC,CAAC;SAClE;QAED,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;KACvB;;;;;IAMD,MAAM,WAAW,CAAC,IAA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