|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
7 const kWidgetId = "test-non-removable-widget"; |
|
8 |
|
9 // Adding non-removable items to a toolbar or the panel shouldn't change inDefaultState |
|
10 add_task(function() { |
|
11 let navbar = document.getElementById("nav-bar"); |
|
12 ok(CustomizableUI.inDefaultState, "Should start in default state"); |
|
13 |
|
14 let button = createDummyXULButton(kWidgetId, "Test non-removable inDefaultState handling"); |
|
15 CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_NAVBAR); |
|
16 button.setAttribute("removable", "false"); |
|
17 ok(CustomizableUI.inDefaultState, "Should still be in default state after navbar addition"); |
|
18 button.remove(); |
|
19 |
|
20 button = createDummyXULButton(kWidgetId, "Test non-removable inDefaultState handling"); |
|
21 CustomizableUI.addWidgetToArea(kWidgetId, CustomizableUI.AREA_PANEL); |
|
22 button.setAttribute("removable", "false"); |
|
23 ok(CustomizableUI.inDefaultState, "Should still be in default state after panel addition"); |
|
24 button.remove(); |
|
25 ok(CustomizableUI.inDefaultState, "Should be in default state after destroying both widgets"); |
|
26 }); |