Bug 1645286 - Load detail page in about:addons when clicking add-on name r=rpl

Differential Revision: https://phabricator.services.mozilla.com/D79833
This commit is contained in:
Mark Striemer 2020-06-16 15:36:16 +00:00
Родитель 24cbfbeddc
Коммит f603cae945
2 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -2937,6 +2937,7 @@ class AddonCard extends HTMLElement {
!this.expanded &&
(e.target === this.addonNameEl || !e.target.closest("a"))
) {
e.preventDefault();
loadViewFn(`detail/${this.addon.id}`);
} else if (
e.target.localName == "a" &&

Просмотреть файл

@ -252,6 +252,18 @@ add_task(async function testOpenDetailView() {
card.querySelector('[action="expand"]').click();
await loaded;
await goBack(win);
// Test click on add-on name.
card = getAddonCard(doc, id2);
ok(!card.querySelector("addon-details"), "The card isn't expanded");
let addonName = card.querySelector(".addon-name");
loaded = waitForViewLoad(win);
EventUtils.synthesizeMouseAtCenter(addonName, {}, win);
await loaded;
card = getAddonCard(doc, id2);
ok(card.querySelector("addon-details"), "The card is expanded");
await closeView(win);
await extension.unload();
await extension2.unload();
@ -281,6 +293,14 @@ add_task(async function testOpenDetailView() {
"detail",
{ type: "extension", addonId: id2 },
],
["addonsManager", "view", "aboutAddons", "list", { type: "extension" }],
[
"addonsManager",
"view",
"aboutAddons",
"detail",
{ type: "extension", addonId: id2 },
],
]);
});