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

Global styles revisions: reduce visibility check from 2 to 1 revision #53281

Merged
merged 2 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading