|
1 | 1 | describe('Theme', () => {
|
2 |
| - it('Switches to light theme when `forcedTheme` is light', () => { |
3 |
| - cy.visit('/?query={test}&forcedTheme=light'); |
4 |
| - cy.get('body').should('have.class', 'graphiql-light'); |
5 |
| - }); |
| 2 | + describe('`forcedTheme`', () => { |
| 3 | + it('Switches to light theme when `forcedTheme` is light', () => { |
| 4 | + cy.visit('/?forcedTheme=light'); |
| 5 | + cy.get('body').should('have.class', 'graphiql-light'); |
| 6 | + }); |
| 7 | + |
| 8 | + it('Switches to dark theme when `forcedTheme` is dark', () => { |
| 9 | + cy.visit('/?forcedTheme=dark'); |
| 10 | + cy.get('body').should('have.class', 'graphiql-dark'); |
| 11 | + }); |
6 | 12 |
|
7 |
| - it('Switches to dark theme when `forcedTheme` is dark', () => { |
8 |
| - cy.visit('/?query={test}&forcedTheme=dark'); |
9 |
| - cy.get('body').should('have.class', 'graphiql-dark'); |
| 13 | + it('Defaults to light theme when `forcedTheme` value is invalid', () => { |
| 14 | + cy.visit('/?forcedTheme=invalid'); |
| 15 | + cy.get('[data-value=settings]').click(); |
| 16 | + cy.get('.graphiql-dialog-section-title') |
| 17 | + .eq(1) |
| 18 | + .should('have.text', 'Theme'); // Check for the presence of the theme dialog |
| 19 | + }); |
10 | 20 | });
|
11 | 21 |
|
12 |
| - it('Defaults to light theme when `forcedTheme` value is invalid', () => { |
13 |
| - cy.visit('/?query={test}&forcedTheme=invalid'); |
14 |
| - cy.get('[data-value=settings]').click(); |
15 |
| - cy.get('.graphiql-dialog-section-title').eq(1).should('have.text', 'Theme'); // Check for the presence of the theme dialog |
| 22 | + describe('`defaultTheme`', () => { |
| 23 | + it('should have light theme', () => { |
| 24 | + cy.visit('/?defaultTheme=light'); |
| 25 | + cy.get('body').should('have.class', 'graphiql-light'); |
| 26 | + }); |
| 27 | + it('should have dark theme', () => { |
| 28 | + cy.visit('/?defaultTheme=dark'); |
| 29 | + cy.get('body').should('have.class', 'graphiql-dark'); |
| 30 | + }); |
16 | 31 | });
|
17 | 32 | });
|
0 commit comments