blob: 611f4e3ce01281ea94635f4ff4385f4a3a980056 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
"use strict";
/**
* Check inserting before a node that has moved from the toolbar into a
* non-customizable bit of the browser works.
*/
add_task(async function () {
for (let toolbar of ["nav-bar", "TabsToolbar"]) {
CustomizableUI.createWidget({
id: "real-button",
label: "test real button",
});
CustomizableUI.addWidgetToArea("real-button", toolbar);
CustomizableUI.addWidgetToArea("moved-button-not-here", toolbar);
let placements = CustomizableUI.getWidgetIdsInArea(toolbar);
Assert.deepEqual(
placements.slice(-2),
["real-button", "moved-button-not-here"],
"Should have correct placements"
);
let otherButton = document.createXULElement("toolbarbutton");
otherButton.id = "moved-button-not-here";
if (toolbar == "nav-bar") {
gURLBar.textbox.parentNode.appendChild(otherButton);
} else {
gBrowser.tabContainer.appendChild(otherButton);
}
CustomizableUI.destroyWidget("real-button");
CustomizableUI.createWidget({
id: "real-button",
label: "test real button",
});
let button = document.getElementById("real-button");
ok(button, "Button should exist");
if (button) {
let expectedContainer = CustomizableUI.getCustomizationTarget(
document.getElementById(toolbar)
);
is(
button.parentNode,
expectedContainer,
"Button should be in the toolbar"
);
}
CustomizableUI.destroyWidget("real-button");
otherButton.remove();
CustomizableUI.reset();
}
});
|