@@ -68,4 +68,36 @@ describe("Paging.cy.tsx", () => {
6868 // Check pagination class set
6969 cy . get ( "[data-cy-root] > .container-fluid" ) . should ( "have.class" , "paging" ) ;
7070 } ) ;
71+
72+ it ( "paging without change of page size" , ( ) => {
73+ const itemsPerPage = faker . datatype . number ( { min : 1 , max : 999 } ) ;
74+ const pages = faker . datatype . number ( { min : 3 , max : 999 } ) ;
75+ const currentPage = faker . datatype . number ( { min : 2 , max : pages - 1 } ) ;
76+ const translations = { showedItemsText : "Item {from} to {to} from {total}" , itemsPerPageDropdown : "Items per page" } ;
77+
78+ cy . mount (
79+ < Paging
80+ currentItemsPerPage = { itemsPerPage }
81+ currentPage = { currentPage }
82+ currentRecordCount = { itemsPerPage }
83+ setCurrentPage = { cy . spy ( ) . as ( "setCurrentPage" ) }
84+ totalRecords = { pages * itemsPerPage }
85+ setItemsPerPage = { cy . spy ( ) . as ( "setItemsPerPage" ) }
86+ translations = { translations }
87+ changePageSizePossible = { false }
88+ /> ,
89+ ) ;
90+
91+ // Check pages per item dropdown is not shown by checking that the first child is the paging from to text
92+ cy . get ( "[data-cy-root] > .container-fluid > .row > .col-6:first-of-type" )
93+ . children ( )
94+ . first ( )
95+ . should (
96+ "have.text" ,
97+ translations . showedItemsText
98+ . replace ( "{from}" , ( currentPage * itemsPerPage - itemsPerPage + 1 ) . toString ( ) )
99+ . replace ( "{to}" , ( currentPage * itemsPerPage ) . toString ( ) )
100+ . replace ( "{total}" , ( pages * itemsPerPage ) . toString ( ) ) ,
101+ ) ;
102+ } ) ;
71103} ) ;
0 commit comments