Repository navigation
Site Editor: Fix the frame snapping to the mobile width when resized with the mouse #86423
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4b99997
Site Editor: Keep the frame width after resizing it with the mouse
claude 1df652d
Site Editor: Remove the comment on the frame width passed to size
claude 49c8e49
Components: Correct the changelog entry for the re-resizable update
claude 80393c1
Update changelog entry
t-hamano 38a5045
Site Editor: Explain why the frame passes its width to size
t-hamano d2073c5
Site Editor: Test that the frame keeps its width after a mouse resize
claude cc2caae
Site Editor: Convert the resizable frame test to TypeScript
claude c21ac9c
Site Editor: Remove the dependency group comment from the resizable f…
claude 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
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,57 @@ | ||
| import { test, expect } from '@wordpress/e2e-test-utils-playwright'; | ||
|
|
||
| // Whether the run targets the extensible site editor (v2). | ||
| const isSiteEditorV2 = !! process.env.GUTENBERG_E2E_SITE_EDITOR_V2; | ||
|
|
||
| test.describe( 'Resizable frame', () => { | ||
| test.skip( | ||
| isSiteEditorV2, | ||
| 'The extensible site editor does not render the resizable frame.' | ||
| ); | ||
|
|
||
| test.beforeAll( async ( { requestUtils } ) => { | ||
| await requestUtils.activateTheme( 'emptytheme' ); | ||
| } ); | ||
|
|
||
| test.afterAll( async ( { requestUtils } ) => { | ||
| await requestUtils.activateTheme( 'twentytwentyone' ); | ||
| } ); | ||
|
|
||
| test( 'keeps its width after being resized with the mouse', async ( { | ||
| admin, | ||
| page, | ||
| } ) => { | ||
| await admin.visitSiteEditor(); | ||
|
|
||
| const frame = page.locator( '.edit-site-resizable-frame__inner' ); | ||
| const getFrameWidth = () => | ||
| frame.evaluate( | ||
| ( element ) => element.getBoundingClientRect().width | ||
| ); | ||
| await frame.hover(); | ||
|
|
||
| const handle = page.getByRole( 'separator', { | ||
| name: 'Drag to resize', | ||
| } ); | ||
| await expect( handle ).toBeVisible(); | ||
|
|
||
| const initialWidth = await getFrameWidth(); | ||
| const handleBox = await handle.boundingBox(); | ||
| if ( ! handleBox ) { | ||
| throw new Error( 'Resize handle bounding box not available' ); | ||
| } | ||
| const handleX = handleBox.x + handleBox.width / 2; | ||
| const handleY = handleBox.y + handleBox.height / 2; | ||
|
|
||
| await page.mouse.move( handleX, handleY ); | ||
| await page.mouse.down(); | ||
| await page.mouse.move( handleX + 100, handleY, { steps: 10 } ); | ||
|
|
||
| const resizedWidth = await getFrameWidth(); | ||
| expect( resizedWidth ).toBeLessThan( initialWidth ); | ||
|
|
||
| await page.mouse.up(); | ||
| await expect( frame ).not.toContainClass( 'is-resizing' ); | ||
| expect( await getFrameWidth() ).toBeCloseTo( resizedWidth, 0 ); | ||
| } ); | ||
| } ); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.