Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nav block: link text color inheritance fixes and tests (#51710)
* tests and fix for link color inheritance * test agains emptytheme too, refactor setup, added better comments * change setup for tests * removed inherit color for the moment on the block * finished the first test with all cases * finished second test * finished third test * started the last test * spacing on comments * removed unnecessary actions from before/after testing functions * insert specific id of nav directly to speed up things * finish checking colors in the editor on desktop * test the overlay and reset settings * use variables for colors, cover rest of the cases to test * introduced a third link to cover non submenu links * undo unwanted change * finish the overlay background tests and fix issues with inheritance * turn colors into variables for readibility * fix wrong color syntax * Create test page before creating navigation menu * Add test coverage for selecting group text color that should be inherited by all links This test is currently failing. TDD. * Fix incorrect selector structure. The &:where(.wp-block-navigation-item a) rule would never apply, as .wp-block-navigation__responsive-container would never also have a .wp-block-navigation-item class on it. Adding the space allows it to apply the inherit rule to the a tag. * Update tests to check for black text defaults on navigation links * Big refactor of navigation color tests * Changed link names from non-descriptive firstLink, secondLink, and thirdLink to clearer names: customLink, submenuLink, and pageLink. * Combined some repeated operations such as openEditorOverlay, openFrontendOverlay, and resetGlobalStyles * Added ColorControl for keeping track of all the link selectors * Revert link color settings changing the navigation link colors The trunk behavior is to have text color global styles change the navigation color styles, while the global link color styles do not change the navigation colors. Also updated the tests to not have any of those color changes impact the submenus. * Large refactor of navigation color tests It was getting difficult to work within several very long tests with a lot of shared code, so I refactored into shared pieces that would make writing the tests easier while keeping debugging easy as well. Also, one large change was to remove the reliance on global styles since resetting the global styles after a failed test was proving very difficult, and we don't need to use global styles since we can rely on creating a group instead. By wrapping a group on the navigation block we can test the same thing while not needing to deal with global styles. * Add test for navigation background colors Also added closing the sidebar in the tests so we don't accidentally grab the links from the sidebar when the navigation block has the sidebar menu open with the same link text. * Add test to ensure navigation text does not inherit link color from the theme/group * Only set default navigation submenu and overlay text colors if no navigation text color is selected * Have li navigation items inherit background color so it can be inherited by the submenu background * Change how to test editor mobile overlay colors The tests were a little flaky when tryingn to click the button to open the mobile view since the animation from desktop to mobile in the editor took some time, and the test was trying to click the open menu button before it was able to be clicked. This updates the test to use the navigation settings itself, which doesn't have an animation, so it should be more reliable. * Move navigation color tests to own file * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js * update comments * Update test/e2e/specs/editor/blocks/navigation-colors.spec.js --------- Co-authored-by: Jerry Jones <[email protected]> Co-authored-by: Ben Dwyer <[email protected]>
- Loading branch information
033c5e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 033c5e3.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5544279058
📝 Reported issues:
specs/editor/plugins/block-context.test.js