|
1 | 1 | describe('Tab Demo Test', () => { |
2 | | - beforeEach(() => { |
| 2 | + it('Navigate to demo section', () => { |
3 | 3 | cy.visit('http://localhost:3000/tabs-horizontal-overflow-demo-nav-link'); |
4 | 4 | }); |
5 | 5 |
|
6 | | - it( |
7 | | - 'Allows users to select a tab from the overflow menu', |
8 | | - { |
9 | | - defaultCommandTimeout: 10000 |
10 | | - }, |
11 | | - () => { |
12 | | - // verify that the expected tabs are showing/not showing as expected based on screen size |
13 | | - [ |
14 | | - 'Tab item 1', |
15 | | - 'Tab item 2', |
16 | | - 'Tab item 3', |
17 | | - 'Tab item 4', |
18 | | - 'Tab item 5', |
19 | | - 'Tab item 6', |
20 | | - 'Tab item 7', |
21 | | - 'More' |
22 | | - ].forEach((tab) => cy.contains('.pf-v6-c-tabs__link', tab).should('exist')); |
23 | | - ['Tab item 8', 'Tab item 9', 'Tab item 10', 'Tab item 11'].forEach((tab) => cy.contains(tab).should('not.exist')); |
24 | | - |
25 | | - // open the overflow menu and verify that the overflowing tabs are now visible within it |
26 | | - cy.contains('.pf-v6-c-tabs__link', 'More').click(); |
27 | | - cy.wait(8000); |
28 | | - ['Tab item 8', 'Tab item 9', 'Tab item 10', 'Tab item 11'].forEach((menuItem) => |
29 | | - cy.contains(menuItem).should('exist') |
30 | | - ); |
31 | | - |
32 | | - // select a tab and verify that it replaces the default overflow tab text, closes the overflow menu, and shows its content |
33 | | - cy.contains('Tab item 9').click(); |
34 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('not.exist'); |
35 | | - cy.contains('.pf-v6-c-tabs__link', 'Tab item 9').should('exist'); |
36 | | - ['Tab item 8', 'Tab item 10', 'Tab item 11'].forEach((menuItem) => cy.contains(menuItem).should('not.exist')); |
37 | | - cy.contains('Tab 9 section').should('not.be.hidden'); |
| 6 | + it('Updates overflow tab title based on tab selection', () => { |
| 7 | + cy.contains('.pf-v6-c-tabs__link', 'More').should('exist'); |
| 8 | + cy.contains('Tab item 9').should('not.exist'); |
| 9 | + cy.contains('.pf-v6-c-tabs__link', 'More').click(); |
| 10 | + cy.contains('Tab item 9').click(); |
| 11 | + cy.contains('More').should('not.exist'); |
| 12 | + cy.contains('.pf-v6-c-tabs__link', 'Tab item 9').should('exist'); |
| 13 | + cy.contains('Tab item 1').click(); |
| 14 | + cy.contains('Tab item 9').should('not.exist'); |
| 15 | + cy.contains('More').should('exist'); |
| 16 | + }); |
38 | 17 |
|
39 | | - // select a non-overflow tab and verify that overflow tab text returns to the default and the now selected tab content shows |
40 | | - cy.contains('Tab item 1').click(); |
41 | | - cy.contains('Tab item 9').should('not.exist'); |
42 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('exist'); |
43 | | - cy.contains('Tab 9 section').should('be.hidden'); |
44 | | - cy.contains('Tab 1 section').should('not.be.hidden'); |
45 | | - } |
46 | | - ); |
| 18 | + it('Allows selection of tabs from overflow tab menu', () => { |
| 19 | + cy.contains('Tab 1 section').should('not.be.hidden'); |
| 20 | + cy.contains('Tab 9 section').should('be.hidden'); |
| 21 | + cy.contains('.pf-v6-c-tabs__link', 'More').click(); |
| 22 | + cy.contains('Tab item 9').click(); |
| 23 | + cy.contains('Tab 9 section').should('not.be.hidden'); |
| 24 | + cy.contains('Tab 1 section').should('be.hidden'); |
| 25 | + }); |
47 | 26 |
|
48 | 27 | // Re-enable once https://github.com/patternfly/patternfly/issues/7449 is resolved |
49 | 28 | xit('Adjusts tabs showing on resize', () => { |
@@ -77,31 +56,4 @@ describe('Tab Demo Test', () => { |
77 | 56 | ].forEach((tab) => cy.contains('.pf-v6-c-tabs__link', tab).should('exist')); |
78 | 57 | cy.contains('.pf-v6-c-tabs__link', 'More').should('not.exist'); |
79 | 58 | }); |
80 | | - |
81 | | - it('Allows overflow tab customization via HorizontalOverflowObject properties', () => { |
82 | | - // verify that tab count can be shown and that the count updates on resize |
83 | | - cy.get('#toggle-show-count-overflow').click(); |
84 | | - cy.viewport(800, 792); |
85 | | - cy.contains('.pf-v6-c-tabs__link', 'More (5)').should('exist'); |
86 | | - cy.viewport(700, 792); |
87 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('exist'); |
88 | | - cy.get('#toggle-show-count-overflow').click(); |
89 | | - |
90 | | - // verify that the default overflow tab title text can be changed and still behaves as the default text should |
91 | | - cy.get('#toggle-change-toggle-text').click(); |
92 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('not.exist'); |
93 | | - cy.contains('.pf-v6-c-tabs__link', 'Overflow').should('exist'); |
94 | | - cy.contains('.pf-v6-c-tabs__link', 'Overflow').click(); |
95 | | - cy.contains('Tab item 9').click(); |
96 | | - cy.contains('.pf-v6-c-tabs__link', 'Overflow').should('not.exist'); |
97 | | - cy.contains('Tab item 1').click(); |
98 | | - cy.contains('.pf-v6-c-tabs__link', 'Overflow').should('exist'); |
99 | | - cy.get('#toggle-change-toggle-text').click(); |
100 | | - |
101 | | - // verify that the overflow tab aria label can be updated |
102 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('not.have.attr', 'aria-label'); |
103 | | - cy.get('#toggle-add-aria-label').click(); |
104 | | - cy.contains('.pf-v6-c-tabs__link', 'More').should('have.attr', 'aria-label', 'Overflow aria label'); |
105 | | - cy.get('#toggle-add-aria-label').click(); |
106 | | - }); |
107 | 59 | }); |
0 commit comments