-
Notifications
You must be signed in to change notification settings - Fork 355
/
expandablesection.spec.ts
49 lines (44 loc) · 1.63 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
37
38
39
40
41
42
43
44
45
46
47
48
49
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-c-expandable-section__toggle')
.first()
.click();
cy.get('.pf-c-expandable-section')
.first()
.should('have.class', 'pf-m-expanded');
});
it('Verify uncontrolled expandable', () => {
cy.get('.pf-c-expandable-section__toggle')
.last()
.click();
cy.get('.pf-c-expandable-section')
.last()
.should('have.class', 'pf-m-expanded');
});
it('Verify dynamic uncontrolled expandable', () => {
cy.get('.pf-c-expandable-section__toggle')
.find('span')
.should('contain', 'Show More');
cy.get('.pf-c-expandable-section__toggle')
.last()
.click();
cy.get('.pf-c-expandable-section__toggle')
.find('span')
.should('contain', 'Show Less');
});
it('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-c-expandable-section__toggle').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');
});
});