Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 0510659

Browse files
author
Shammamah Hossain
committed
Add test for submitting page number with enter key.
1 parent 900e49d commit 0510659

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

tests/cypress/tests/server/pagination_test.ts

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,35 @@ describe('table pagination', () => {
9191
});
9292

9393
describe('with the text input box', () => {
94-
it('correctly navigates to the desired page', () => {
95-
cy.get('input.current-page').click();
96-
DOM.focused.type(`14`);
97-
cy.get('input.current-page').blur();
98-
99-
cy.get('button.first-page').should('not.be.disabled');
100-
cy.get('button.previous-page').should('not.be.disabled');
101-
cy.get('input.current-page').should('have.attr', 'placeholder', '14');
102-
cy.get('.last-page').should('have.html', '29');
103-
cy.get('button.next-page').should('not.be.disabled');
104-
cy.get('button.last-page').should('not.be.disabled');
94+
describe('correctly navigates to the desired page', () => {
95+
it('with unfocus', () => {
96+
cy.get('input.current-page').click();
97+
DOM.focused.type(`14`);
98+
cy.get('input.current-page').blur();
10599

106-
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '66'));
100+
cy.get('button.first-page').should('not.be.disabled');
101+
cy.get('button.previous-page').should('not.be.disabled');
102+
cy.get('input.current-page').should('have.attr', 'placeholder', '14');
103+
cy.get('.last-page').should('have.html', '29');
104+
cy.get('button.next-page').should('not.be.disabled');
105+
cy.get('button.last-page').should('not.be.disabled');
107106

107+
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '66'));
108+
}),
109+
it('with enter', () => {
110+
cy.get('input.current-page').click();
111+
DOM.focused.type(`18${Key.Enter}`);
112+
113+
cy.get('button.first-page').should('not.be.disabled');
114+
cy.get('button.previous-page').should('not.be.disabled');
115+
cy.get('input.current-page').should('have.attr', 'placeholder', '18');
116+
cy.get('input.current-page').should('not.be.focused');
117+
cy.get('.last-page').should('have.html', '29');
118+
cy.get('button.next-page').should('not.be.disabled');
119+
cy.get('button.last-page').should('not.be.disabled');
120+
121+
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '86'));
122+
})
108123
});
109124

110125
describe('can handle invalid page numbers', () => {

0 commit comments

Comments
 (0)