mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 801040 - Add Social API status-area menuitems to the keyboard accessible Social API menu. r=felipe
--HG-- extra : rebase_source : 9160314d39864c70cc94e9b08c007a14d2b2dca1
This commit is contained in:
parent
b6634dd70f
commit
1f4c21777f
@ -482,9 +482,7 @@
|
|||||||
accesskey="&toolsMenu.accesskey;">
|
accesskey="&toolsMenu.accesskey;">
|
||||||
<menupopup id="menu_ToolsPopup"
|
<menupopup id="menu_ToolsPopup"
|
||||||
#ifdef MOZ_SERVICES_SYNC
|
#ifdef MOZ_SERVICES_SYNC
|
||||||
onpopupshowing="gSyncUI.updateUI(); SocialMenu.populate();"
|
onpopupshowing="gSyncUI.updateUI();"
|
||||||
#else
|
|
||||||
onpopupshowing="SocialMenu.populate();"
|
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
<menuitem id="menu_search"
|
<menuitem id="menu_search"
|
||||||
@ -510,9 +508,23 @@
|
|||||||
autocheck="false"
|
autocheck="false"
|
||||||
command="Social:Toggle"/>
|
command="Social:Toggle"/>
|
||||||
<menu id="menu_socialAmbientMenu"
|
<menu id="menu_socialAmbientMenu"
|
||||||
class="show-only-for-keyboard"
|
class="show-only-for-keyboard">
|
||||||
command="Social:Toggle">
|
<menupopup id="menu_socialAmbientMenuPopup">
|
||||||
<menupopup id="menu_socialAmbientMenuPopup"/>
|
<menuseparator id="socialAmbientMenuSeparator"
|
||||||
|
hidden="true"/>
|
||||||
|
<menuitem id="social-toggle-sidebar-keyboardmenuitem"
|
||||||
|
type="checkbox"
|
||||||
|
autocheck="false"
|
||||||
|
command="Social:ToggleSidebar"
|
||||||
|
label="&social.toggleSidebar.label;"
|
||||||
|
accesskey="&social.toggleSidebar.accesskey;"/>
|
||||||
|
<menuitem id="social-toggle-notifications-keyboardmenuitem"
|
||||||
|
type="checkbox"
|
||||||
|
autocheck="false"
|
||||||
|
command="Social:ToggleNotifications"
|
||||||
|
label="&social.toggleNotifications.label;"
|
||||||
|
accesskey="&social.toggleNotifications.accesskey;"/>
|
||||||
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
#ifdef MOZ_SERVICES_SYNC
|
#ifdef MOZ_SERVICES_SYNC
|
||||||
<!-- only one of sync-setup or sync-menu will be showing at once -->
|
<!-- only one of sync-setup or sync-menu will be showing at once -->
|
||||||
|
@ -62,7 +62,7 @@ let SocialUI = {
|
|||||||
break;
|
break;
|
||||||
case "social:ambient-notification-changed":
|
case "social:ambient-notification-changed":
|
||||||
SocialToolbar.updateButton();
|
SocialToolbar.updateButton();
|
||||||
SocialMenu.updateMenu();
|
SocialMenu.populate();
|
||||||
break;
|
break;
|
||||||
case "social:profile-changed":
|
case "social:profile-changed":
|
||||||
SocialToolbar.updateProfile();
|
SocialToolbar.updateProfile();
|
||||||
@ -72,6 +72,8 @@ let SocialUI = {
|
|||||||
case "nsPref:changed":
|
case "nsPref:changed":
|
||||||
SocialSidebar.updateSidebar();
|
SocialSidebar.updateSidebar();
|
||||||
SocialToolbar.updateButton();
|
SocialToolbar.updateButton();
|
||||||
|
SocialMenu.populate();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -99,6 +101,7 @@ let SocialUI = {
|
|||||||
SocialToolbar.init();
|
SocialToolbar.init();
|
||||||
SocialShareButton.init();
|
SocialShareButton.init();
|
||||||
SocialSidebar.init();
|
SocialSidebar.init();
|
||||||
|
SocialMenu.populate();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateToggleCommand: function SocialUI_updateToggleCommand() {
|
updateToggleCommand: function SocialUI_updateToggleCommand() {
|
||||||
@ -598,24 +601,28 @@ var SocialMenu = {
|
|||||||
populate: function SocialMenu_populate() {
|
populate: function SocialMenu_populate() {
|
||||||
// This menu is only accessible through keyboard navigation.
|
// This menu is only accessible through keyboard navigation.
|
||||||
let submenu = document.getElementById("menu_socialAmbientMenuPopup");
|
let submenu = document.getElementById("menu_socialAmbientMenuPopup");
|
||||||
while (submenu.hasChildNodes())
|
let ambientMenuItems = submenu.getElementsByClassName("ambient-menuitem");
|
||||||
submenu.removeChild(submenu.firstChild);
|
for (let ambientMenuItem of ambientMenuItems)
|
||||||
|
submenu.removeChild(ambientMenuItem);
|
||||||
let provider = Social.provider;
|
let provider = Social.provider;
|
||||||
if (Social.active && provider) {
|
if (Social.active && provider) {
|
||||||
let iconNames = Object.keys(provider.ambientNotificationIcons);
|
let iconNames = Object.keys(provider.ambientNotificationIcons);
|
||||||
|
let separator = document.getElementById("socialAmbientMenuSeparator");
|
||||||
for (let name of iconNames) {
|
for (let name of iconNames) {
|
||||||
let icon = provider.ambientNotificationIcons[name];
|
let icon = provider.ambientNotificationIcons[name];
|
||||||
if (!icon.label || !icon.menuURL)
|
if (!icon.label || !icon.menuURL)
|
||||||
continue;
|
continue;
|
||||||
let menuitem = document.createElement("menuitem");
|
let menuitem = document.createElement("menuitem");
|
||||||
menuitem.setAttribute("label", icon.label);
|
menuitem.setAttribute("label", icon.label);
|
||||||
|
menuitem.classList.add("ambient-menuitem");
|
||||||
menuitem.addEventListener("command", function() {
|
menuitem.addEventListener("command", function() {
|
||||||
openUILinkIn(icon.menuURL, "tab");
|
openUILinkIn(icon.menuURL, "tab");
|
||||||
}, false);
|
}, false);
|
||||||
submenu.appendChild(menuitem);
|
submenu.insertBefore(menuitem, separator);
|
||||||
}
|
}
|
||||||
|
separator.hidden = !iconNames.length;
|
||||||
}
|
}
|
||||||
document.getElementById("menu_socialAmbientMenu").hidden = !submenu.querySelector("menuitem");
|
document.getElementById("menu_socialAmbientMenu").hidden = !Social.enabled;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ var tests = {
|
|||||||
toolsPopup.removeEventListener("popupshown", ontoolspopupshownNoAmbient);
|
toolsPopup.removeEventListener("popupshown", ontoolspopupshownNoAmbient);
|
||||||
let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
|
let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
|
||||||
ok(socialToggleMore, "Keyboard accessible social menu should exist");
|
ok(socialToggleMore, "Keyboard accessible social menu should exist");
|
||||||
is(socialToggleMore.hidden, true, "Menu should be hidden when no ambient notifications.");
|
is(socialToggleMore.querySelectorAll("menuitem").length, 2, "The minimum number of menuitems is two when there are no ambient notifications.");
|
||||||
|
is(socialToggleMore.hidden, false, "Menu should be visible since we show some non-ambient notifications in the menu.");
|
||||||
toolsPopup.hidePopup();
|
toolsPopup.hidePopup();
|
||||||
next();
|
next();
|
||||||
}, false);
|
}, false);
|
||||||
@ -85,6 +86,7 @@ var tests = {
|
|||||||
toolsPopup.removeEventListener("popupshown", ontoolspopupshownAmbient);
|
toolsPopup.removeEventListener("popupshown", ontoolspopupshownAmbient);
|
||||||
let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
|
let socialToggleMore = document.getElementById("menu_socialAmbientMenu");
|
||||||
ok(socialToggleMore, "Keyboard accessible social menu should exist");
|
ok(socialToggleMore, "Keyboard accessible social menu should exist");
|
||||||
|
is(socialToggleMore.querySelectorAll("menuitem").length, 3, "The number of menuitems is minimum plus one ambient notification menuitem.");
|
||||||
is(socialToggleMore.hidden, false, "Menu is visible when ambient notifications have label & menuURL");
|
is(socialToggleMore.hidden, false, "Menu is visible when ambient notifications have label & menuURL");
|
||||||
let menuitem = socialToggleMore.querySelector("menuitem");
|
let menuitem = socialToggleMore.querySelector("menuitem");
|
||||||
is(menuitem.getAttribute("label"), "Test Ambient 1", "Keyboard accessible ambient menuitem should have specified label");
|
is(menuitem.getAttribute("label"), "Test Ambient 1", "Keyboard accessible ambient menuitem should have specified label");
|
||||||
@ -109,11 +111,15 @@ var tests = {
|
|||||||
testShowSidebarMenuitemExists: function(next) {
|
testShowSidebarMenuitemExists: function(next) {
|
||||||
let toggleSidebarMenuitem = document.getElementById("social-toggle-sidebar-menuitem");
|
let toggleSidebarMenuitem = document.getElementById("social-toggle-sidebar-menuitem");
|
||||||
ok(toggleSidebarMenuitem, "Toggle Sidebar menuitem exists");
|
ok(toggleSidebarMenuitem, "Toggle Sidebar menuitem exists");
|
||||||
|
let toggleSidebarKeyboardMenuitem = document.getElementById("social-toggle-sidebar-keyboardmenuitem");
|
||||||
|
ok(toggleSidebarKeyboardMenuitem, "Toggle Sidebar keyboard menuitem exists");
|
||||||
next();
|
next();
|
||||||
},
|
},
|
||||||
testShowDesktopNotificationsMenuitemExists: function(next) {
|
testShowDesktopNotificationsMenuitemExists: function(next) {
|
||||||
let toggleDesktopNotificationsMenuitem = document.getElementById("social-toggle-notifications-menuitem");
|
let toggleDesktopNotificationsMenuitem = document.getElementById("social-toggle-notifications-menuitem");
|
||||||
ok(toggleDesktopNotificationsMenuitem, "Toggle notifications menuitem exists");
|
ok(toggleDesktopNotificationsMenuitem, "Toggle notifications menuitem exists");
|
||||||
|
let toggleDesktopNotificationsKeyboardMenuitem = document.getElementById("social-toggle-notifications-keyboardmenuitem");
|
||||||
|
ok(toggleDesktopNotificationsKeyboardMenuitem, "Toggle notifications keyboard menuitem exists");
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user