diff --git a/packages/patternfly-4/react-core/src/components/Pagination/Navigation.tsx b/packages/patternfly-4/react-core/src/components/Pagination/Navigation.tsx index f768eac2099..b4699759b1d 100644 --- a/packages/patternfly-4/react-core/src/components/Pagination/Navigation.tsx +++ b/packages/patternfly-4/react-core/src/components/Pagination/Navigation.tsx @@ -9,6 +9,8 @@ import { KEY_CODES } from '../../helpers/constants'; export interface NavigationProps extends React.HTMLProps { /** Additional classes for the container */ className?: string; + /** Flag indicating if the pagination is disabled */ + isDisabled?: boolean; /** The number of the last page */ lastPage?: number; /** The number of first page where pagination starts */ @@ -55,6 +57,7 @@ export class Navigation extends React.Component + + , + } + } + showToggle={true} + toggleTemplate={[Function]} + widgetId="pagination-options-menu" + > +
+ +
+ +
+
, + } + } + > + +
+ +
+ , + } + } + > + +
+ + + + + + + + + + + + + +`; + +exports[`component render zero results 1`] = ` + +
+
+ 0 items +
+ +
+ + + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isOpen={false} + isPlain={true} + onSelect={[Function]} + toggle={ + + } + > + + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } + > +
+ { cy.url().should('eq', 'http://localhost:3000/pagination-demo-nav-link'); }); + it('should be disabled when flag is present', () => { + cy.get('#pagination-options-menu-disabled').find('.pf-c-options-menu__toggle-text') + .then(toggleText => expect(toggleText).to.have.text('1 - 20 of 523 items')); + cy.get('#pagination-options-menu-disabled').find('button[data-action="first"]') + .then(button => expect(button).to.be.disabled); + cy.get('#pagination-options-menu-disabled').find('button[data-action="previous"]') + .then(button => expect(button).to.be.disabled); + cy.get('#pagination-options-menu-disabled').find('button[data-action="next"]') + .then(button => expect(button).to.be.disabled); + cy.get('#pagination-options-menu-disabled').find('button[data-action="last"]') + .then(button => expect(button).to.be.disabled); + cy.get('#pagination-options-menu-disabled > .pf-c-options-menu > .pf-c-dropdown').find('button') + .then(button => expect(button).to.be.disabled); + }); + it('Verify initial state', () => { - cy.get('.pf-c-pagination').should('have.length', 2); + cy.get('.pf-c-pagination').should('have.length', 3); cy.get('#pagination-options-menu-bottom.pf-c-pagination.pf-m-footer').should('exist'); cy.get('#pagination-options-menu-top').find('.pf-c-options-menu__toggle-text') .then(toggleText => expect(toggleText).to.have.text('1 - 20 of 523 items')); diff --git a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/PaginationDemo/PaginationDemo.tsx b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/PaginationDemo/PaginationDemo.tsx index eda9bb40300..d9580ae81dc 100644 --- a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/PaginationDemo/PaginationDemo.tsx +++ b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/PaginationDemo/PaginationDemo.tsx @@ -1,7 +1,10 @@ import React from 'react'; import { Pagination, - PaginationVariant + PaginationVariant, + Stack, + StackItem, + Title } from '@patternfly/react-core'; type OptionsMenuDemoState = { @@ -35,30 +38,59 @@ export class PaginationDemo extends React.Component + Pagination + + + + + + ); + } - render() { + renderDisabled() { return ( - - - - + + Disabled state + + + + ); } + + + render() { + return + {this.renderPagination()} + {this.renderDisabled()} + ; + } } export default PaginationDemo;