Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | registerCleanupFunction(removeCustomToolbars); |
michael@0 | 8 | |
michael@0 | 9 | // Sanity checks |
michael@0 | 10 | add_task(function sanityChecks() { |
michael@0 | 11 | SimpleTest.doesThrow(function() CustomizableUI.registerArea("@foo"), |
michael@0 | 12 | "Registering areas with an invalid ID should throw."); |
michael@0 | 13 | |
michael@0 | 14 | SimpleTest.doesThrow(function() CustomizableUI.registerArea([]), |
michael@0 | 15 | "Registering areas with an invalid ID should throw."); |
michael@0 | 16 | |
michael@0 | 17 | SimpleTest.doesThrow(function() CustomizableUI.unregisterArea("@foo"), |
michael@0 | 18 | "Unregistering areas with an invalid ID should throw."); |
michael@0 | 19 | |
michael@0 | 20 | SimpleTest.doesThrow(function() CustomizableUI.unregisterArea([]), |
michael@0 | 21 | "Unregistering areas with an invalid ID should throw."); |
michael@0 | 22 | |
michael@0 | 23 | SimpleTest.doesThrow(function() CustomizableUI.unregisterArea("unknown"), |
michael@0 | 24 | "Unregistering an area that's not registered should throw."); |
michael@0 | 25 | }); |
michael@0 | 26 | |
michael@0 | 27 | // Check areas are loaded with their default placements. |
michael@0 | 28 | add_task(function checkLoadedAres() { |
michael@0 | 29 | ok(CustomizableUI.inDefaultState, "Everything should be in its default state."); |
michael@0 | 30 | }); |
michael@0 | 31 | |
michael@0 | 32 | // Check registering and unregistering a new area. |
michael@0 | 33 | add_task(function checkRegisteringAndUnregistering() { |
michael@0 | 34 | const kToolbarId = "test-registration-toolbar"; |
michael@0 | 35 | const kButtonId = "test-registration-button"; |
michael@0 | 36 | createDummyXULButton(kButtonId); |
michael@0 | 37 | createToolbarWithPlacements(kToolbarId, ["spring", kButtonId, "spring"]); |
michael@0 | 38 | assertAreaPlacements(kToolbarId, |
michael@0 | 39 | [/customizableui-special-spring\d+/, |
michael@0 | 40 | kButtonId, |
michael@0 | 41 | /customizableui-special-spring\d+/]); |
michael@0 | 42 | ok(!CustomizableUI.inDefaultState, "With a new toolbar it is no longer in a default state."); |
michael@0 | 43 | removeCustomToolbars(); // Will call unregisterArea for us |
michael@0 | 44 | ok(CustomizableUI.inDefaultState, "When the toolbar is unregistered, " + |
michael@0 | 45 | "everything will return to the default state."); |
michael@0 | 46 | }); |
michael@0 | 47 | |
michael@0 | 48 | add_task(function asyncCleanup() { |
michael@0 | 49 | yield resetCustomization(); |
michael@0 | 50 | }); |