blob: f3189096de6b7ab578bfacec1c823bfc8184877d (
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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function getSpringCount(area) {
return CustomizableUI.getWidgetIdsInArea(area).filter(id =>
id.includes("spring")
).length;
}
/**
* Check that no matter where we add a flexible space, we
* never end up without a flexible space in the palette.
*/
add_task(async function test_flexible_space_addition() {
await startCustomizing();
let palette = document.getElementById("customization-palette");
// Make the bookmarks toolbar visible:
CustomizableUI.setToolbarVisibility(CustomizableUI.AREA_BOOKMARKS, true);
let areas = [CustomizableUI.AREA_NAVBAR, CustomizableUI.AREA_BOOKMARKS];
if (AppConstants.platform != "macosx") {
areas.push(CustomizableUI.AREA_MENUBAR);
}
for (let area of areas) {
let spacer = palette.querySelector("toolbarspring");
let toolbar = document.getElementById(area);
toolbar = CustomizableUI.getCustomizationTarget(toolbar);
let springCount = getSpringCount(area);
simulateItemDrag(spacer, toolbar);
// Check we added the spring:
is(
springCount + 1,
getSpringCount(area),
"Should now have an extra spring"
);
// Check there's still one in the palette:
let newSpacer = palette.querySelector("toolbarspring");
ok(newSpacer, "Should have created a new spring");
}
});
registerCleanupFunction(async function asyncCleanup() {
await endCustomizing();
await resetCustomization();
});
|