зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1015494 - allow disabling panel animations during tests, r=mconley
--HG-- extra : rebase_source : 3dbdf0da5fbce6e432f5a38ae700957445f4a913
This commit is contained in:
Родитель
659fec896a
Коммит
c505617c8d
|
@ -328,6 +328,9 @@ const PanelUI = {
|
|||
tempPanel.setAttribute("type", "arrow");
|
||||
tempPanel.setAttribute("id", "customizationui-widget-panel");
|
||||
tempPanel.setAttribute("class", "cui-widget-panel");
|
||||
if (this._disableAnimations) {
|
||||
tempPanel.setAttribute("animate", "false");
|
||||
}
|
||||
tempPanel.setAttribute("context", "");
|
||||
document.getElementById(CustomizableUI.AREA_NAVBAR).appendChild(tempPanel);
|
||||
// If the view has a footer, set a convenience class on the panel.
|
||||
|
@ -363,6 +366,19 @@ const PanelUI = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* NB: The enable- and disableSingleSubviewPanelAnimations methods only
|
||||
* affect the hiding/showing animations of single-subview panels (tempPanel
|
||||
* in the showSubView method).
|
||||
*/
|
||||
disableSingleSubviewPanelAnimations: function() {
|
||||
this._disableAnimations = true;
|
||||
},
|
||||
|
||||
enableSingleSubviewPanelAnimations: function() {
|
||||
this._disableAnimations = false;
|
||||
},
|
||||
|
||||
onWidgetAfterDOMChange: function(aNode, aNextNode, aContainer, aWasRemoval) {
|
||||
if (aContainer != this.contents) {
|
||||
return;
|
||||
|
|
|
@ -41,6 +41,16 @@ function createSidebarItem() {
|
|||
gSidebarMenu.insertBefore(gTestSidebarItem, gSidebarMenu.firstChild);
|
||||
}
|
||||
|
||||
function addWidget() {
|
||||
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
|
||||
PanelUI.disableSingleSubviewPanelAnimations();
|
||||
}
|
||||
|
||||
function removeWidget() {
|
||||
CustomizableUI.removeWidgetFromArea("sidebar-button");
|
||||
PanelUI.enableSingleSubviewPanelAnimations();
|
||||
}
|
||||
|
||||
// Filters out the trailing menuseparators from the sidebar list
|
||||
function getSidebarList() {
|
||||
let sidebars = [...gSidebarMenu.children];
|
||||
|
@ -76,7 +86,7 @@ let showSidebarPopup = Task.async(function*() {
|
|||
|
||||
// Check the sidebar widget shows the default items
|
||||
add_task(function*() {
|
||||
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
|
||||
addWidget();
|
||||
|
||||
yield showSidebarPopup();
|
||||
|
||||
|
@ -89,13 +99,14 @@ add_task(function*() {
|
|||
document.getElementById("customizationui-widget-panel").hidePopup();
|
||||
yield subviewHiddenPromise;
|
||||
|
||||
return resetCustomization();
|
||||
removeWidget();
|
||||
});
|
||||
|
||||
function add_sidebar_task(description, setup, teardown) {
|
||||
add_task(function*() {
|
||||
info(description);
|
||||
createSidebarItem();
|
||||
addWidget();
|
||||
yield setup();
|
||||
|
||||
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
|
||||
|
@ -114,7 +125,7 @@ function add_sidebar_task(description, setup, teardown) {
|
|||
|
||||
yield teardown();
|
||||
gTestSidebarItem.remove();
|
||||
return resetCustomization();
|
||||
removeWidget();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче