mirror of
https://github.com/penpot/penpot.git
synced 2026-09-08 13:09:22 +00:00
🐛 Stop opening Comments section from persisting display-comments (#11492)
AI-assisted-by: claude-sonnet-5
This commit is contained in:
parent
f2f352d06c
commit
214dbd0c8b
@ -600,6 +600,12 @@ export class WorkspacePage extends BaseWebSocketPage {
|
||||
.getByRole("button", { name: "Comments (C)" })
|
||||
.click(clickOptions);
|
||||
}
|
||||
|
||||
async toggleCommentsVisibilityFromMenu(clickOptions = {}) {
|
||||
await this.page.getByRole("button", { name: "Main menu" }).click();
|
||||
await this.page.getByText("view").last().click();
|
||||
await this.page.locator("#file-menu-comments").click(clickOptions);
|
||||
}
|
||||
}
|
||||
|
||||
export default WorkspacePage;
|
||||
|
||||
@ -35,3 +35,64 @@ test("Group bubbles when zooming out if they overlap", async ({ page }) => {
|
||||
/unread/,
|
||||
);
|
||||
});
|
||||
|
||||
test("Opening the Comments section only temporarily overrides a disabled global comments setting", async ({
|
||||
page,
|
||||
}) => {
|
||||
const workspacePage = new WasmWorkspacePage(page);
|
||||
await workspacePage.setupEmptyFile();
|
||||
await workspacePage.setupFileWithComments();
|
||||
await workspacePage.goToWorkspace();
|
||||
|
||||
const bubble = page.getByTestId("floating-thread-bubble-1");
|
||||
|
||||
// "Display comments" is enabled by default, so the bubble is already visible.
|
||||
await expect(bubble).toBeVisible();
|
||||
|
||||
// Turn the global "Display comments" setting off from the main menu.
|
||||
await workspacePage.toggleCommentsVisibilityFromMenu();
|
||||
await expect(bubble).toBeHidden();
|
||||
|
||||
// Opening the Comments section shows comments regardless of the global setting.
|
||||
await workspacePage.showComments();
|
||||
await expect(bubble).toBeVisible();
|
||||
|
||||
// Closing the Comments section falls back to the (still disabled) global setting.
|
||||
await workspacePage.showComments();
|
||||
await expect(bubble).toBeHidden();
|
||||
|
||||
// The global setting itself must be untouched by opening/closing the section.
|
||||
await page.getByRole("button", { name: "Main menu" }).click();
|
||||
await page.getByText("view").last().click();
|
||||
await expect(page.locator("#file-menu-comments")).toContainText(
|
||||
"Show comments",
|
||||
);
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
test("Comments stay visible through opening and closing the Comments section when the global setting is enabled", async ({
|
||||
page,
|
||||
}) => {
|
||||
const workspacePage = new WasmWorkspacePage(page);
|
||||
await workspacePage.setupEmptyFile();
|
||||
await workspacePage.setupFileWithComments();
|
||||
await workspacePage.goToWorkspace();
|
||||
|
||||
const bubble = page.getByTestId("floating-thread-bubble-1");
|
||||
|
||||
// "Display comments" is enabled by default.
|
||||
await expect(bubble).toBeVisible();
|
||||
|
||||
await workspacePage.showComments();
|
||||
await expect(bubble).toBeVisible();
|
||||
|
||||
await workspacePage.showComments();
|
||||
await expect(bubble).toBeVisible();
|
||||
|
||||
await page.getByRole("button", { name: "Main menu" }).click();
|
||||
await page.getByText("view").last().click();
|
||||
await expect(page.locator("#file-menu-comments")).toContainText(
|
||||
"Hide comments",
|
||||
);
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
[app.main.data.workspace.drawing.common :as common]
|
||||
[app.main.data.workspace.drawing.curve :as curve]
|
||||
[app.main.data.workspace.drawing.line :as line]
|
||||
[app.main.data.workspace.layout :as dwlo]
|
||||
[app.main.data.workspace.path :as path]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
@ -47,11 +46,6 @@
|
||||
(when (= tool :path)
|
||||
(rx/of (start-drawing :path)))
|
||||
|
||||
;; NOTE: comments are a special case and they manage they
|
||||
;; own interrupt cycle.
|
||||
(when (= tool :comments)
|
||||
(rx/of (dwlo/toggle-layout-flag :display-comments :force? true)))
|
||||
|
||||
(when (and (not= tool :comments)
|
||||
(not= tool :path))
|
||||
(let [stopper (rx/filter (ptk/type? ::clear-drawing) stream)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user