Skip to content

Commit

Permalink
Global styles revisions: reduce visibility check from 2 to 1 revision (
Browse files Browse the repository at this point in the history
…#53281)

* Now that #52965 has merged, we can show the revisions panel when there are more than 0 revisions since there is the default with which we can compare the single revision

* Update E2E test to reflect the changes in this PR
  • Loading branch information
ramonjd authored Aug 3, 2023
1 parent e70d419 commit f040080
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/global-styles/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function GlobalStylesRevisionsMenu() {
goTo( '/revisions' );
setEditorCanvasContainerView( 'global-styles-revisions' );
};
const hasRevisions = revisionsCount >= 1;
const hasRevisions = revisionsCount > 0;

return (
<GlobalStylesMenuFill>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
}, [ openGlobalStyles, setEditorCanvasContainerView ] );

// If there are no revisions, do not render a footer.
const hasRevisions = revisionsCount >= 2;
const hasRevisions = revisionsCount > 0;
const modifiedDateTime = revisions?.[ 0 ]?.modified;
const shouldShowGlobalStylesFooter =
hasRevisions && ! isLoadingRevisions && modifiedDateTime;
Expand Down
17 changes: 2 additions & 15 deletions test/e2e/specs/site-editor/user-global-styles-revisions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe( 'Global styles revisions', () => {
await admin.visitSiteEditor();
} );

test( 'should display revisions UI when there is more than 1 revision', async ( {
test( 'should display revisions UI when there is 1 revision', async ( {
page,
editor,
userGlobalStylesRevisions,
Expand All @@ -39,19 +39,6 @@ test.describe( 'Global styles revisions', () => {
// Change a style and save it.
await page.getByRole( 'button', { name: 'Colors styles' } ).click();

await page
.getByRole( 'button', { name: 'Color Background styles' } )
.click();
await page
.getByRole( 'button', { name: 'Color: Black' } )
.click( { force: true } );

await editor.saveSiteEditorEntities();

/*
* Change a style and save it again.
* We need more than 2 revisions to show the UI.
*/
await page
.getByRole( 'button', { name: 'Color Background styles' } )
.click();
Expand All @@ -70,7 +57,7 @@ test.describe( 'Global styles revisions', () => {

// There should be 2 revisions not including the reset to theme defaults button.
await expect( revisionButtons ).toHaveCount(
currentRevisions.length + 2
currentRevisions.length + 1
);
} );

Expand Down

0 comments on commit f040080

Please sign in to comment.