Skip to content

Commit

Permalink
improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas742 committed Aug 6, 2024
1 parent 9b79b91 commit aa98fd6
Showing 1 changed file with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,8 @@ describe('AnalyticalTable', () => {
cy.findByTestId('payloadRowsById').should('have.text', '{"1":true,"2":true,"3":false}');
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'false');

//select all
//click
cy.get('[data-row-index="0"][data-column-index="0"]').click();
cy.get('@onRowSelectSpy').should('have.callCount', 6);
cy.findByTestId('payload').should(
Expand All @@ -635,6 +637,33 @@ describe('AnalyticalTable', () => {
);
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'true');

// enter (keydown)
cy.get('[data-row-index="0"][data-column-index="0"]').realPress('Enter');
cy.get('@onRowSelectSpy').should('have.callCount', 7);
cy.findByTestId('payload').should('have.text', '[]');
cy.findByTestId('payloadRowsById').should('have.text', '{}');
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'false');

// Space (keyup) + ArrowDown => 1st row selected
cy.get('[data-row-index="0"][data-column-index="0"]').realPress(['Space', 'ArrowDown']);
cy.get('@onRowSelectSpy').should('have.callCount', 8);
cy.findByTestId('payload').should('have.text', '["0"]');
cy.findByTestId('payloadRowsById').should('have.text', '{"0":true}');
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'false');

// Space (keyup) + ArrowUp => all rows selected
cy.get('[data-row-index="0"][data-column-index="0"]').realPress(['Space', 'ArrowUp']);
cy.get('@onRowSelectSpy').should('have.callCount', 9);
cy.findByTestId('payload').should(
'have.text',
'["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"]'
);
cy.findByTestId('payloadRowsById').should(
'have.text',
'{"0":true,"1":true,"2":true,"3":true,"4":true,"5":true,"6":true,"7":true,"8":true,"9":true,"10":true,"11":true,"12":true,"13":true,"14":true,"15":true,"16":true,"17":true,"18":true,"19":true,"20":true}'
);
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'true');

cy.get('[data-row-index="0"][data-column-index="0"]').click();

cy.findByText('Name-0').click();
Expand All @@ -647,7 +676,7 @@ describe('AnalyticalTable', () => {
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'false');

cy.get('[data-row-index="0"][data-column-index="0"]').click();
cy.get('@onRowSelectSpy').should('have.callCount', 11);
cy.get('@onRowSelectSpy').should('have.callCount', 14);
cy.findByTestId('payload').should('have.text', '["0","1","5","7","17","20"]');
cy.findByTestId('payloadRowsById').should('have.text', '{"0":true,"1":true,"5":true,"7":true,"17":true,"20":true}');
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'false');
Expand Down Expand Up @@ -702,7 +731,7 @@ describe('AnalyticalTable', () => {
'{"0":true,"1":true,"2":true,"3":true,"4":true,"5":true,"6":true,"7":true,"8":true,"9":true,"10":true,"11":true,"12":true,"13":true,"14":true,"15":true,"16":true,"17":true,"18":true,"19":true,"20":true}'
);
cy.findByTestId('payloadAllRowsSelected').should('have.text', 'true');
cy.get('@onRowSelectSpy').should('have.callCount', 16);
cy.get('@onRowSelectSpy').should('have.callCount', 19);
});

it('row & header height', () => {
Expand Down

0 comments on commit aa98fd6

Please sign in to comment.