-
Notifications
You must be signed in to change notification settings - Fork 356
/
Copy pathaccordion.spec.ts
31 lines (27 loc) · 1.35 KB
/
accordion.spec.ts
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
describe('Accordion Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/accordion-demo-nav-link');
});
it('Is not focusable when isFixed is false and content would overflow', () => {
cy.get('#divAccordion-item1-toggle').click();
cy.get('#divAccordion-item1-content').should('not.have.attr', 'tabindex');
cy.get('#divAccordion-item1-content').click();
cy.get('#divAccordion-item1-content').should('not.have.focus');
});
it('Is not focusable when isFixed is true and content does not overflow', () => {
cy.get('#divAccordion-item2-toggle').click();
cy.get('#divAccordion-item2-content').should('not.have.attr', 'tabindex');
cy.get('#divAccordion-item2-content').click();
cy.get('#divAccordion-item2-content').should('not.have.focus');
});
it('Is focusable when isFixed is true and content overflows', () => {
cy.get('#divAccordion-item3-toggle').click();
cy.get('#divAccordion-item3-content').should('have.attr', 'tabindex', '0');
cy.get('#divAccordion-item3-content').click();
cy.get('#divAccordion-item3-content').should('have.focus');
});
it('Role attribute is applied correctly', () => {
cy.get('#divAccordion-item3-content').should('have.attr', 'role', 'region');
cy.get('#definitionListAccordion-item1-content').should('not.have.attr', 'role');
});
});