Skip to content
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
29 changes: 29 additions & 0 deletions test/integration/comment_spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -594,5 +594,34 @@ describe("Comment", () => {
})
);
});

it("must check that comments can be selected/unselected", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await switchToComment(page);

const firstElementSelector =
"#editorCommentsSidebarList li:first-child";
await waitAndClick(page, firstElementSelector);
const popupSelector = "#commentPopup";
await page.waitForSelector(popupSelector, { visible: true });
const popupTextSelector = `${popupSelector} .commentPopupText`;
await page.waitForSelector(popupTextSelector, {
visible: true,
});
const popupText = await page.evaluate(
selector => document.querySelector(selector).textContent,
popupTextSelector
);
expect(popupText)
.withContext(`In ${browserName}`)
.toEqual("ABCDEFGHIJKLMNOPQRSTUVWXYZ");

// Click again to unselect the comment.
await waitAndClick(page, firstElementSelector);
await page.waitForSelector(popupSelector, { visible: false });
})
);
});
});
});
2 changes: 2 additions & 0 deletions web/comment_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ class CommentSidebar {

async #commentClick({ currentTarget }) {
if (currentTarget.classList.contains("selected")) {
currentTarget.classList.remove("selected");
this.#popup._hide();
return;
}
const annotation = this.#elementsToAnnotations.get(currentTarget);
Expand Down