File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
src/material/paginator/testing
tools/public_api_guard/material Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,18 @@ export abstract class _MatPaginatorHarnessBase extends ComponentHarness {
3636 return ( await this . _nextButton ( ) ) . click ( ) ;
3737 }
3838
39+ /** Returns whether or not the next page button is enabled. */
40+ async isNextPageEnabled ( ) : Promise < boolean > {
41+ const disabledValue = await ( await this . _nextButton ( ) ) . getAttribute ( 'disabled' ) ;
42+ return disabledValue != 'disabled' ;
43+ }
44+
45+ /* Returns whether or not the previous page button is enabled. */
46+ async isPreviousPageEnabled ( ) : Promise < boolean > {
47+ const disabledValue = await ( await this . _nextButton ( ) ) . getAttribute ( 'disabled' ) ;
48+ return disabledValue != 'disabled' ;
49+ }
50+
3951 /** Goes to the previous page in the paginator. */
4052 async goToPreviousPage ( ) : Promise < void > {
4153 return ( await this . _previousButton ( ) ) . click ( ) ;
Original file line number Diff line number Diff line change @@ -97,6 +97,17 @@ export function runHarnessTests(
9797 ) ;
9898 } ) ;
9999
100+ it ( 'should return whether or not the previous page is disabled' , async ( ) => {
101+ const paginator = await loader . getHarness ( paginatorHarness ) ;
102+ expect ( await paginator . isPreviousPageEnabled ( ) ) . toBe ( true ) ;
103+ } ) ;
104+
105+ it ( 'should return whether or not the next page is disabled' , async ( ) => {
106+ const paginator = await loader . getHarness ( paginatorHarness ) ;
107+ await paginator . goToLastPage ( ) ;
108+ expect ( await paginator . isNextPageEnabled ( ) ) . toBe ( true ) ;
109+ } ) ;
110+
100111 it ( 'should throw an error if the last page button is not available' , async ( ) => {
101112 const paginator = await loader . getHarness ( paginatorHarness ) ;
102113
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ export abstract class _MatPaginatorHarnessBase extends ComponentHarness {
4141 goToLastPage(): Promise <void >;
4242 goToNextPage(): Promise <void >;
4343 goToPreviousPage(): Promise <void >;
44+ isNextPageEnabled(): Promise <boolean >;
45+ // (undocumented)
46+ isPreviousPageEnabled(): Promise <boolean >;
4447 // (undocumented)
4548 protected abstract _lastPageButton: AsyncFactoryFn <TestElement | null >;
4649 // (undocumented)
You can’t perform that action at this time.
0 commit comments