-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate site editor to use new preferences package (#39158)
* Replace more menu with interface package version * Add preferences dependency to the site editor * Migrate site editor localstorage preference data to preferences package * Use preferences for fixedToolbar and focusMode * Use preferences store for welcome guides * Remove unused FeatureToggle component * Deprecate toggleFeature action * Deprecate isFeatureActive * Migrate editor mode * Remove defunct reducer tests * Simplify toggleMoreMenu and clickOnMoreMenuItem e2e utils * Migrate the editor mode local storage data * Fix selector bug - getPreference must be exported * Add test mocks for preferences * Update e2e test actions and selectors * Add action/selector tests for isFeatureActive and toggleFeature
- Loading branch information
Showing
26 changed files
with
169 additions
and
324 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,35 +1,16 @@ | ||
/** | ||
* @typedef {import("./shared/types").GutenbergContext} GutenbergContext | ||
*/ | ||
|
||
const SELECTORS = { | ||
postEditorMenuContent: '.interface-more-menu-dropdown__content', | ||
siteEditorMenuContent: '.edit-site-more-menu__content', | ||
postEditorMenu: '.interface-more-menu-dropdown [aria-label="Options"]', | ||
siteEditorMenu: '.edit-site-more-menu [aria-label="More tools & options"]', | ||
}; | ||
|
||
/** | ||
* Toggles the More Menu. | ||
* | ||
* @param {'open' | 'close'} [waitFor] Whether it should wait for the menu to open or close. If `undefined` it won't wait for anything. | ||
* @param {GutenbergContext} [context='post-editor'] Whether it's toggling in the context of the site editor or post editor. | ||
* @param {'open' | 'close'} [waitFor] Whether it should wait for the menu to open or close. If `undefined` it won't wait for anything. | ||
*/ | ||
export async function toggleMoreMenu( waitFor, context = 'post-editor' ) { | ||
const menuSelector = | ||
context === 'post-editor' | ||
? SELECTORS.postEditorMenu | ||
: SELECTORS.siteEditorMenu; | ||
export async function toggleMoreMenu( waitFor ) { | ||
const menuSelector = '.interface-more-menu-dropdown [aria-label="Options"]'; | ||
|
||
await page.click( menuSelector ); | ||
|
||
if ( waitFor ) { | ||
const opts = waitFor === 'close' ? { hidden: true } : {}; | ||
const menuContentSelector = | ||
context === 'post-editor' | ||
? SELECTORS.postEditorMenuContent | ||
: SELECTORS.siteEditorMenuContent; | ||
|
||
const menuContentSelector = '.interface-more-menu-dropdown__content'; | ||
await page.waitForSelector( menuContentSelector, opts ); | ||
} | ||
} |
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
55 changes: 0 additions & 55 deletions
55
packages/edit-site/src/components/header/feature-toggle/index.js
This file was deleted.
Oops, something went wrong.
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
29 changes: 0 additions & 29 deletions
29
packages/edit-site/src/components/header/more-menu/style.scss
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.