-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block list: Add option in editor settings to show open list view as d…
…efault (#40757) * initial commit * Added option to site editor * Change key to `showListViewByDefault` Add basic e2e test Update snapshots Add example single test run to playwright readme * Use `name` in locator selector * Move dispatch to initialize editor methods to avoid unnecessary re-renders using useEffect * Set default value of showListViewByDefault to `false` in the post editor.
- Loading branch information
Showing
8 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
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
40 changes: 40 additions & 0 deletions
40
test/e2e/specs/site-editor/block-list-panel-preference.spec.js
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,40 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Block list view', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'emptytheme' ); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test( 'Should open by default', async ( { page, pageUtils } ) => { | ||
await pageUtils.visitSiteEditor( { | ||
postId: 'emptytheme//index', | ||
postType: 'wp_template', | ||
} ); | ||
|
||
// Should display the Preview button. | ||
await expect( | ||
page.locator( 'role=region[name="List View"i]' ) | ||
).not.toBeVisible(); | ||
|
||
// Turn on block list view by default. | ||
await page.evaluate( () => { | ||
window.wp.data | ||
.dispatch( 'core/preferences' ) | ||
.set( 'core/edit-site', 'showListViewByDefault', true ); | ||
} ); | ||
|
||
await page.reload(); | ||
|
||
// Should display the Preview button. | ||
await expect( | ||
page.locator( 'role=region[name="List View"i]' ) | ||
).toBeVisible(); | ||
} ); | ||
} ); |