forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccordion.spec.ts
More file actions
34 lines (31 loc) · 1.57 KB
/
accordion.spec.ts
File metadata and controls
34 lines (31 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
describe('Accordion Demo Test', () => {
it('Navigate to Accordion section', () => {
cy.visit('http://localhost:3000/accordion-demo-nav-link');
});
it('Verify toggle open behavior', () => {
cy.get('#item-1').click();
cy.get('#item-1').should('have.attr', 'aria-expanded', 'true');
cy.get('#item-2').should('have.attr', 'aria-expanded', 'false');
cy.get('#item-3').should('have.attr', 'aria-expanded', 'false');
const expandedContent = cy.get('#accordion-example .pf-c-accordion__expanded-content.pf-m-expanded');
expandedContent.should('have.length', 1);
expandedContent.should('have.attr', 'id', 'item-1-content');
});
it('Verify toggle switch behavior', () => {
cy.get('#item-2').click();
cy.get('#item-1').should('have.attr', 'aria-expanded', 'false');
cy.get('#item-2').should('have.attr', 'aria-expanded', 'true');
cy.get('#item-3').should('have.attr', 'aria-expanded', 'false');
const expandedContent = cy.get('#accordion-example .pf-c-accordion__expanded-content.pf-m-expanded');
expandedContent.should('have.length', 1);
expandedContent.should('have.attr', 'id', 'item-2-content');
});
it('Verify toggle close behavior', () => {
cy.get('#item-2').click();
cy.get('#item-1').should('have.attr', 'aria-expanded', 'false');
cy.get('#item-2').should('have.attr', 'aria-expanded', 'false');
cy.get('#item-3').should('have.attr', 'aria-expanded', 'false');
const expandedContent = cy.get('#accordion-example .pf-c-accordion__expanded-content.pf-m-expanded');
expandedContent.should('not.exist');
});
});