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 {
36
36
return ( await this . _nextButton ( ) ) . click ( ) ;
37
37
}
38
38
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
+
39
51
/** Goes to the previous page in the paginator. */
40
52
async goToPreviousPage ( ) : Promise < void > {
41
53
return ( await this . _previousButton ( ) ) . click ( ) ;
Original file line number Diff line number Diff line change @@ -97,6 +97,17 @@ export function runHarnessTests(
97
97
) ;
98
98
} ) ;
99
99
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
+
100
111
it ( 'should throw an error if the last page button is not available' , async ( ) => {
101
112
const paginator = await loader . getHarness ( paginatorHarness ) ;
102
113
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ export abstract class _MatPaginatorHarnessBase extends ComponentHarness {
41
41
goToLastPage(): Promise <void >;
42
42
goToNextPage(): Promise <void >;
43
43
goToPreviousPage(): Promise <void >;
44
+ isNextPageEnabled(): Promise <boolean >;
45
+ // (undocumented)
46
+ isPreviousPageEnabled(): Promise <boolean >;
44
47
// (undocumented)
45
48
protected abstract _lastPageButton: AsyncFactoryFn <TestElement | null >;
46
49
// (undocumented)
You can’t perform that action at this time.
0 commit comments