-
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.
Don't allow template part to be created on the Patterns page for non-…
…block themes
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Hybrid theme', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'gutenberg-test-themes/emptyhybrid' ); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test( 'should not show the Add Template Part button', async ( { | ||
admin, | ||
page, | ||
} ) => { | ||
await admin.visitAdminPage( | ||
'/site-editor.php', | ||
'postType=wp_template_part&path=/wp_template_part/all' | ||
); | ||
|
||
await expect( | ||
page.locator( 'role=button[name="Add New Template Part"i]' ) | ||
).toBeHidden(); | ||
|
||
// Back to Patterns page. | ||
await page.click( | ||
'role=region[name="Navigation"i] >> role=button[name="Back"i]' | ||
); | ||
|
||
await page.click( | ||
'role=region[name="Navigation"i] >> role=button[name="Create pattern"i]' | ||
); | ||
|
||
await expect( | ||
page.locator( 'role=menuitem[name="Create template part"i]' ) | ||
).toBeHidden(); | ||
} ); | ||
} ); |