-
Notifications
You must be signed in to change notification settings - Fork 353
/
Copy pathexpandablesection.spec.ts
36 lines (31 loc) · 1.66 KB
/
expandablesection.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
32
33
34
35
36
describe('Expandable Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/expandable-section-demo-nav-link');
});
it('Verify controlled expandable', () => {
cy.get('.pf-v6-c-expandable-section__toggle > button').first().click();
cy.get('.pf-v6-c-expandable-section').first().should('have.class', 'pf-m-expanded');
});
it('Verify uncontrolled expandable', () => {
cy.get('.pf-v6-c-expandable-section__toggle > button').last().click();
cy.get('.pf-v6-c-expandable-section').last().should('have.class', 'pf-m-expanded');
});
it('Verify dynamic uncontrolled expandable', () => {
cy.get('.pf-v6-c-expandable-section__toggle').find('span').should('contain', 'Show More');
cy.get('.pf-v6-c-expandable-section__toggle > button').last().click();
cy.get('.pf-v6-c-expandable-section__toggle').find('span').should('contain', 'Show Less');
});
// disabled this test because pf-m-detached was removed from core.
xit('Verify detached expandable', () => {
cy.get('#detached').should('have.class', 'pf-m-detached');
cy.get('#detached-section').should('have.class', 'pf-m-detached');
cy.get('#detached button').click();
cy.get('#detached-section').should('have.class', 'pf-m-expanded');
});
it('Verify disclosure expandable', () => {
cy.get('#disclosure-expandable-section > .pf-v6-c-expandable-section__toggle > button').click();
cy.get('#disclosure-expandable-section').should('have.class', 'pf-m-expanded');
cy.get('#disclosure-expandable-section').should('have.class', 'pf-m-display-lg');
cy.get('#disclosure-expandable-section').should('have.class', 'pf-m-limit-width');
});
});