-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: display text if no revisions are found #52865
Global styles revisions: display text if no revisions are found #52865
Conversation
…sions, show some helpful text rather than a loading spinner. Also, add an E2E test!
Size Change: +72 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and is testing well!
Just left a question about whether we should be reusing existing strings now that we're in the RC period of 6.3? Also, it looks like one of the tests needs to be updated to expect isLoading
to be false
now, I think:
Line 120 in b0d20ed
expect( isLoading ).toBe( true ); |
Other than that, this LGTM!
</> | ||
) : ( | ||
<Spacer marginX={ 4 } data-testid="global-styles-no-revisions"> | ||
{ __( 'There are currently no style revisions.' ) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a new string? Since we're in the RC period, I was wondering if it's an issue that it's being added. If so, could we temporarily reuse an existing string from somewhere? No results found.
isn't very friendly, but appears to already exist, in case that's useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be an issue, you're right. Thanks for flagging and suggesting a new string. I YOLO'ed the RC label. I'll try to find an existing string.
test( 'should display no revisions message if landing via command center', async ( { | ||
page, | ||
} ) => { | ||
await page.keyboard.press( 'Meta+k' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on failure traces, the command doesn't open the Command Palette. You can use https://trace.playwright.dev/ to check the Playwright - https://trace.playwright.dev/.
The reasons could be that there is no focus on the editor's body or keyboard shortcuts must be corrected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting. Thanks for the tips. It's passing locally, so I'll try a few things and push them 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it helps, but it looks like the Open the command palette and navigate to the page create page
test moves focus to the command palette button before pressing Meta+k
, so something like that might make it more reliable? E.g.
gutenberg/test/e2e/specs/site-editor/command-center.spec.js
Lines 23 to 25 in a3d81f6
await page | |
.getByRole( 'button', { name: 'Open command palette' } ) | |
.focus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it looks like the Open the command palette and navigate to the page create page test moves focus to the command palette button before pressing Meta+k, so something like that might make it more reliable?
Thanks @andrewserong
That was actually the first thing I tried (copy paste 😄 ) but it wasn't passing locally with that line.
Maybe I'll add it and YOLO it up to CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because that button only exists in view mode. I'm opening the canvas in edit mode. 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just click the button if we're already locating it 😄 But as long as it works, I'm fine with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just click the button if we're already locating it 😄 But as long as it works, I'm fine with it.
I ❤️ copy 🍝
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍝 goes well with e2e tests 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String change and unit test updates LGTM! ✨
Just giving pre-approval so you can merge once the e2e tests are passing 🙂
* If somehow a user lands on the revisions panel when there are no revisions, show some helpful text rather than a loading spinner. Also, add an E2E test! * Updated unit tests to reflect resolver logic changes * Use existing string * Only open edit view when testing the revisions panel itself
* Fix image block v6 deprecation (#52822) * Remove incorrect comment * Add missing attribtes and supports * Add integration tests for the deprecation * Fix incorrect import * Fix fixtures * Image: Use the correct method for caption class in recent deprecation (#52853) * Distraction Free: Fix notices in site editor (#52867) * Distraction Free: Add missing command in site editor (#52868) * Site Editor: Fix the template parts link on the list page (#52891) * Return focus more from focus return hook (#52710) * Disambiguate "Import" button string. (#52907) * Disambiguate "Import" button string. * Add _x to import --------- Co-authored-by: Andrew Serong <[email protected]> * My patterns page: Increase color contrast for the toggle group (#52678) * Update style.scss * Update style.scss * Check if object exists before accessing its properties. (#52870) * Check if object exists before accessing its properties. * Name anonymous functions * Update names * Sidebar: Restore Back buton 'go to parent' functionality (#52910) * Global styles revisions: display text if no revisions are found (#52865) * If somehow a user lands on the revisions panel when there are no revisions, show some helpful text rather than a loading spinner. Also, add an E2E test! * Updated unit tests to reflect resolver logic changes * Use existing string * Only open edit view when testing the revisions panel itself * ResizableFrame: Account for window resizing (#52697) * ResizableFrame: Account for window resizing * Don't memoize --------- Co-authored-by: Robert Anderson <[email protected]> * Distraction Free: Fix conflict with showListViewByDefault preference (#52914) * Backporting changes from WordPress/wordpress-develop#4891 * Site Editor: Open template parts in view canvas view mode (#52916) --------- Co-authored-by: Alex Lende <[email protected]> Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: Andrew Serong <[email protected]> Co-authored-by: Mitchell Austin <[email protected]> Co-authored-by: Jb Audras <[email protected]> Co-authored-by: Carolina Nymark <[email protected]> Co-authored-by: Robert Anderson <[email protected]> Co-authored-by: Ramon <[email protected]> Co-authored-by: Lena Morita <[email protected]> Co-authored-by: ramon <[email protected]>
Thanks for the PR! I have the feeling that it would be better just to add the command conditionally based on the existence of revisions. We would just have to use a commandLoader. What do you think? |
Thanks for the feedback. Good idea! I did think of that, and we could probably do that too to be consistent with the styles panel. Maybe via a selector or hook so the logic is centralized. The motivation behind this change was remove the persistent loading spinner as the default functionality of the revisions panel. I wanted to do it for a while but needed the nudge 😄 It doesn't reflect state for one, plus we might need to open the revisions panel to add further functionality in the future, or maybe a plugin/theme finds a way to open it programmatically. |
What?
If somehow a user lands on the revisions panel when there are no revisions, show some helpful text rather than a loading spinner.
Also, add an E2E test!
Why?
When testing #52728 I noticed that the global styles revisions panel will show the loading spinner where there are no revisions.
This was previously hidden from the UI since one could not open the panel if there were no revisions.
How?
Using a combination of
isResolving
andrevisions.length
to determine if:a) A request has been dispatched
b) The response contains revisions
Testing Instructions
/wp-admin/site-editor.php?canvas=edit
Cmd/Ctrl-K
) and type in "revisions"Screenshots
Before
2023-07-24.13.47.52.mp4
After
2023-07-24.15.14.22.mp4