Merge pull request #20322 from calixteman/bug1990491
[Editor] Add the possibility to unselect a comment from the sidebar
This commit is contained in:
commit
7fa50712c9
@ -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 });
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user