Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index view for Templates & Parts: use grid layout as default #60069

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update new-templates-list e2e test
  • Loading branch information
oandregal committed Apr 4, 2024
commit 5121a5ec1c1f107f0659d60f803f141444284473
29 changes: 18 additions & 11 deletions test/e2e/specs/site-editor/new-templates-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ test.describe( 'Templates', () => {
requestUtils.deleteAllTemplates( 'wp_template' ),
] );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.afterEach( async ( { requestUtils } ) => {
await requestUtils.deleteAllTemplates( 'wp_template' );
} );

test( 'Sorting', async ( { admin, page } ) => {
await admin.visitSiteEditor( { path: '/wp_template' } );

// Descending by title.
await page
.getByRole( 'button', { name: 'Template', exact: true } )
.click();
await page
.getByRole( 'menuitemradio', {
name: 'Sort descending',
} )
.click();
await page.getByRole( 'button', { name: 'View options' } ).click();
await page.getByRole( 'menuitem', { name: 'Sort by' } ).click();
await page.getByRole( 'menuitem', { name: 'Template' } ).click();
await page.getByRole( 'menuitemradio', { name: 'descending' } ).click();
const firstTitle = page
.getByRole( 'region', {
name: 'Template',
Expand All @@ -35,12 +35,12 @@ test.describe( 'Templates', () => {
.getByRole( 'link', { includeHidden: true } )
.first();
await expect( firstTitle ).toHaveText( 'Tag Archives' );

// Ascending by title.
await page
.getByRole( 'menuitemradio', { name: 'Sort ascending' } )
.click();
await page.getByRole( 'menuitemradio', { name: 'ascending' } ).click();
await expect( firstTitle ).toHaveText( 'Category Archives' );
} );

test( 'Filtering', async ( { requestUtils, admin, page } ) => {
await requestUtils.createTemplate( 'wp_template', {
slug: 'date',
Expand Down Expand Up @@ -82,10 +82,17 @@ test.describe( 'Templates', () => {
await page.keyboard.press( 'Escape' ); // close the menu.
await expect( titles ).toHaveCount( 2 );
} );

test( 'Field visibility', async ( { admin, page } ) => {
await admin.visitSiteEditor( { path: '/wp_template' } );

await page.getByRole( 'button', { name: 'View options' } ).click();
await page.getByRole( 'menuitem', { name: 'Layout' } ).click();
await page.getByRole( 'menuitemradio', { name: 'Table' } ).click();

await page.getByRole( 'button', { name: 'Description' } ).click();
await page.getByRole( 'menuitem', { name: 'Hide' } ).click();

await expect(
page.getByRole( 'button', { name: 'Description' } )
).toBeHidden();
Expand Down
Loading