-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2866 from Codeinwp/cypress/palette-switch-test
test: adds test for palette switch
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
e2e-tests/cypress/fixtures/customizer/hfg/hfg-palette-switch-component.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"neve_ran_builder_migration": true, | ||
"neve_migrated_builders": true, | ||
"neve_migrated_hfg_colors": true, | ||
"nav_menu_locations": { | ||
"primary": 176 | ||
}, | ||
"header_palette_switch_icon_size": "{\"mobile\":16,\"tablet\":16,\"desktop\":44}", | ||
"hfg_header_layout": "{\"desktop\":{\"top\":[{\"x\":7,\"y\":1,\"width\":1,\"height\":1,\"id\":\"header_palette_switch\"}],\"main\":[{\"x\":0,\"y\":1,\"width\":4,\"height\":1,\"id\":\"logo\"},{\"x\":4,\"y\":1,\"width\":8,\"height\":1,\"id\":\"primary-menu\"}],\"bottom\":[]},\"mobile\":{\"top\":[],\"main\":[{\"x\":0,\"y\":1,\"width\":8,\"height\":1,\"id\":\"logo\"},{\"x\":8,\"y\":1,\"width\":4,\"height\":1,\"id\":\"nav-icon\"}],\"bottom\":[],\"sidebar\":[{\"x\":0,\"y\":1,\"width\":8,\"height\":1,\"id\":\"primary-menu\"}]}}" | ||
} |
41 changes: 41 additions & 0 deletions
41
e2e-tests/cypress/integration/customizer/hfg/hfg-palette-switch-component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
describe('Palette Switch component', function () { | ||
before('Setup by adding a new palette', function () { | ||
cy.fixture('customizer/hfg/hfg-palette-switch-component').then((setup) => { | ||
cy.setCustomizeSettings(setup); | ||
}); | ||
}); | ||
|
||
it('Changes the color palette by clicking', function () { | ||
cy.visit('/'); | ||
cy.get('h2').should('have.css', 'color', 'rgb(57, 57, 57)'); | ||
cy.get('.icon > svg > path').click(); | ||
cy.get('h2').should('have.css', 'color', 'rgb(255, 255, 255)'); | ||
}); | ||
|
||
it('Removes color palette from website', function () { | ||
cy.setCustomizeSettings({}); | ||
cy.visit('/'); | ||
cy.get('.icon > svg > path').should('not.exist'); | ||
}); | ||
}); | ||
|
||
describe('Palette Swich auto', function () { | ||
before('Setup', function () { | ||
cy.fixture('customizer/hfg/hfg-palette-switch-component').then((setup) => { | ||
setup.header_palette_switch_auto_adjust_color = 1; | ||
cy.setCustomizeSettings(setup); | ||
}); | ||
}); | ||
|
||
it('Automatically changes the color palette when dark is default', function () { | ||
cy.setLocalStorage('neve_user_theme', 'dark'); | ||
cy.visit('/'); | ||
cy.get('h2').should('have.css', 'color', 'rgb(255, 255, 255)'); | ||
}); | ||
|
||
it('Automatically changes the color palette when light is default', function () { | ||
cy.setLocalStorage('neve_user_theme', 'light'); | ||
cy.visit('/'); | ||
cy.get('h2').should('have.css', 'color', 'rgb(57, 57, 57)'); | ||
}); | ||
}); |