Bug 1348396 - Only show a badge on PanelUI while in fullscreen r=enndeakin+6102

Previously we were showing a doorhanger when the user moused to the
top of the screen while in fullscreen mode. However, the doorhanger
would disappear before the user had a chance to interact with it.
We decided it's best anyway to simply display a badge when the user
is in fullscreen, and to reshow the doorhanger when the user exits
fullscreen.

MozReview-Commit-ID: ENRtXC4wqvZ

--HG--
extra : rebase_source : d0ddc7395115287620ed4c9532297e825996be1d
This commit is contained in:
Doug Thayer 2017-04-10 11:11:45 -07:00
Родитель f80e60fc76
Коммит 7810cd0dda
2 изменённых файлов: 43 добавлений и 2 удалений

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

@ -685,8 +685,14 @@ const PanelUI = {
this._showMenuItem(this.notifications[0]);
}
} else if (doorhangers.length > 0) {
this._clearBadge();
this._showNotificationPanel(doorhangers[0]);
if (window.fullScreen) {
this._hidePopup();
this._showBadge(doorhangers[0]);
this._showMenuItem(doorhangers[0]);
} else {
this._clearBadge();
this._showNotificationPanel(doorhangers[0]);
}
} else {
this._hidePopup();
this._showBadge(this.notifications[0]);

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

@ -303,3 +303,38 @@ add_task(function* testMultipleNonBadges() {
ok(updateManualAction.called, "update-manual main action callback was called");
});
});
add_task(function* testFullscreen() {
let doc = document;
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
let mainActionCalled = false;
let mainAction = {
callback: () => { mainActionCalled = true; }
};
PanelUI.showNotification("update-manual", mainAction);
isnot(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is showing.");
let notifications = [...PanelUI.notificationPanel.children].filter(n => !n.hidden);
is(notifications.length, 1, "PanelUI doorhanger is only displaying one notification.");
let doorhanger = notifications[0];
is(doorhanger.id, "PanelUI-update-manual-notification", "PanelUI is displaying the update-manual notification.");
EventUtils.synthesizeKey("VK_F11", {});
yield BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popuphidden");
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
window.FullScreen.showNavToolbox();
is(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is displaying on PanelUI button.");
EventUtils.synthesizeKey("VK_F11", {});
yield BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popupshown");
isnot(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is showing.");
isnot(PanelUI.menuButton.getAttribute("badge-status"), "update-manual", "Badge is not displaying on PanelUI button.");
let mainActionButton = doc.getAnonymousElementByAttribute(doorhanger, "anonid", "button");
mainActionButton.click();
ok(mainActionCalled, "Main action callback was called");
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
is(PanelUI.menuButton.hasAttribute("badge-status"), false, "Should not have a badge status");
});