-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(editor): add showMenuRight URL param to hide right-side toolbar #7553
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
Open
JohnMcLear
wants to merge
4
commits into
ether:develop
Choose a base branch
from
JohnMcLear:fix/hide-menu-right-5182
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+84
−0
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d48a4f3
feat(editor): add showMenuRight URL param to hide right-side toolbar
JohnMcLear feae2a6
fix(editor): auto-hide menu_right on readonly pads, accept showMenuRi…
JohnMcLear f2a97a9
test(7553): use actual readonly-URL selector in Playwright spec
JohnMcLear c1f4bc2
test(7553): wait for share popup before clicking readonly checkbox
JohnMcLear 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import {expect, Page, test} from "@playwright/test"; | ||
| import {appendQueryParams, goToNewPad} from "../helper/padHelper"; | ||
|
|
||
| test.beforeEach(async ({page}) => { | ||
| // clearCookies on the page's own context — creating a separate | ||
| // BrowserContext and clearing cookies on it is a no-op for the page | ||
| // fixture (Qodo review feedback on #7553). | ||
| await page.context().clearCookies(); | ||
| await goToNewPad(page); | ||
| }); | ||
|
|
||
| test.describe('showMenuRight URL parameter', function () { | ||
| test('without the parameter, .menu_right is visible', async function ({page}) { | ||
| await expect(page.locator('#editbar .menu_right')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('showMenuRight=false hides .menu_right', async function ({page}) { | ||
| await appendQueryParams(page, {showMenuRight: 'false'}); | ||
| await expect(page.locator('#editbar .menu_right')).toBeHidden(); | ||
| // The left menu stays visible so the pad remains navigable. | ||
| await expect(page.locator('#editbar .menu_left')).toBeVisible(); | ||
| }); | ||
|
|
||
| test('showMenuRight=true keeps .menu_right visible', async function ({page}) { | ||
| await appendQueryParams(page, {showMenuRight: 'true'}); | ||
| await expect(page.locator('#editbar .menu_right')).toBeVisible(); | ||
| }); | ||
|
|
||
| // Helper: open the Share popup, flip it to read-only, read the r.* URL | ||
| // back out of #linkinput. The readonly toggle is a checkbox | ||
| // (`#readonlyinput`) that rewrites #linkinput's value live. The popup | ||
| // animates open, so the checkbox is briefly "not stable" — wait for | ||
| // the popup's show class before interacting, and use force:true so a | ||
| // trailing transform doesn't trip Playwright's stability check. | ||
| const getReadonlyUrl = async (page: Page) => { | ||
| await page.locator('.buttonicon-embed').click(); | ||
| await page.locator('#embed.popup-show').waitFor({state: 'visible'}); | ||
| await page.locator('#readonlyinput').check({force: true}); | ||
| await page.waitForFunction( | ||
| () => (document.querySelector('#linkinput') as HTMLInputElement | null) | ||
| ?.value.includes('/p/r.')); | ||
| const url = await page.locator('#linkinput').inputValue(); | ||
| expect(url).toMatch(/\/p\/r\./); | ||
| return url; | ||
| }; | ||
|
|
||
| test('readonly pad hides .menu_right by default', async function ({page}) { | ||
| const readonlyUrl = await getReadonlyUrl(page); | ||
| await page.goto(readonlyUrl); | ||
| await page.waitForSelector('#editorcontainer.initialized'); | ||
| await expect(page.locator('#editbar .menu_right')).toBeHidden(); | ||
| }); | ||
|
|
||
| test('readonly pad with showMenuRight=true keeps the menu visible', async function ({page}) { | ||
| const readonlyUrl = await getReadonlyUrl(page); | ||
| await page.goto(`${readonlyUrl}?showMenuRight=true`); | ||
| await page.waitForSelector('#editorcontainer.initialized'); | ||
| await expect(page.locator('#editbar .menu_right')).toBeVisible(); | ||
| }); | ||
| }); |
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.