Bug 1207491 - Part 4: Remove use of expression closure from browser/components/customizableui/test/. r=Gijs

This commit is contained in:
Tooru Fujisawa 2015-09-23 18:36:20 +09:00
parent af895a68f9
commit 8c1010c009
10 changed files with 18 additions and 18 deletions

View File

@ -8,19 +8,19 @@ registerCleanupFunction(removeCustomToolbars);
// Sanity checks
add_task(function sanityChecks() {
SimpleTest.doesThrow(function() CustomizableUI.registerArea("@foo"),
SimpleTest.doesThrow(() => CustomizableUI.registerArea("@foo"),
"Registering areas with an invalid ID should throw.");
SimpleTest.doesThrow(function() CustomizableUI.registerArea([]),
SimpleTest.doesThrow(() => CustomizableUI.registerArea([]),
"Registering areas with an invalid ID should throw.");
SimpleTest.doesThrow(function() CustomizableUI.unregisterArea("@foo"),
SimpleTest.doesThrow(() => CustomizableUI.unregisterArea("@foo"),
"Unregistering areas with an invalid ID should throw.");
SimpleTest.doesThrow(function() CustomizableUI.unregisterArea([]),
SimpleTest.doesThrow(() => CustomizableUI.unregisterArea([]),
"Unregistering areas with an invalid ID should throw.");
SimpleTest.doesThrow(function() CustomizableUI.unregisterArea("unknown"),
SimpleTest.doesThrow(() => CustomizableUI.unregisterArea("unknown"),
"Unregistering an area that's not registered should throw.");
});

View File

@ -82,7 +82,7 @@ add_task(function() {
yield shownPanelPromise;
let chevron = document.getElementById("nav-bar-overflow-button");
yield waitForCondition(function() chevron.open);
yield waitForCondition(() => chevron.open);
yield waitForSearchBarFocus();
@ -116,7 +116,7 @@ add_task(function() {
openUILinkInCalled = false;
sendWebSearchKeyCommand();
yield waitForCondition(function() openUILinkInCalled);
yield waitForCondition(() => openUILinkInCalled);
ok(openUILinkInCalled, "The search page should have been opened.")
expectOpenUILinkInCall = false;
} catch (e) {

View File

@ -15,7 +15,7 @@ add_task(function() {
simulateItemDrag(devButton, downloadsButton);
simulateItemDrag(searchBox, palette);
gCustomizeMode.reset();
yield waitForCondition(function() !gCustomizeMode.resetting);
yield waitForCondition(() => !gCustomizeMode.resetting);
ok(CustomizableUI.inDefaultState, "Should be back in default state");
yield endCustomizing();
});

View File

@ -36,7 +36,7 @@ add_task(function() {
yield startCustomizing();
gCustomizeMode.reset();
yield waitForCondition(function() !gCustomizeMode.resetting);
yield waitForCondition(() => !gCustomizeMode.resetting);
yield endCustomizing();
is(bookmarksToolbar.collapsed, true, "Customization reset should restore collapsed-state to the bookmarks toolbar");
@ -60,7 +60,7 @@ add_task(function() {
yield startCustomizing();
gCustomizeMode.reset();
yield waitForCondition(function() !gCustomizeMode.resetting);
yield waitForCondition(() => !gCustomizeMode.resetting);
is(menubar.getAttribute("autohide"), "true", "The menubar should have autohide=true after reset in customization mode");
is(menubar.getBoundingClientRect().height, 0, "The menubar should have height=0 after reset in customization mode");
@ -88,7 +88,7 @@ add_task(function() {
ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
gCustomizeMode.reset();
yield waitForCondition(function() !gCustomizeMode.resetting);
yield waitForCondition(() => !gCustomizeMode.resetting);
ok(bookmarksToolbar.collapsed, "The bookmarksToolbar should be collapsed after reset");
ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");

View File

@ -18,8 +18,8 @@ add_task(function() {
addonsButton.click();
newTab = gBrowser.selectedTab;
yield waitForCondition(function() gBrowser.currentURI &&
gBrowser.currentURI.spec == "about:addons");
yield waitForCondition(() => gBrowser.currentURI &&
gBrowser.currentURI.spec == "about:addons");
let addonsPage = gBrowser.selectedBrowser.contentWindow.document.
getElementById("addons-page");

View File

@ -13,7 +13,7 @@ registerCleanupFunction(removeCustomToolbars);
// Sanity checks
add_task(function() {
let brokenSpec = {id: kWidgetId + (widgetCounter++), removable: false};
SimpleTest.doesThrow(function() CustomizableUI.createWidget(brokenSpec),
SimpleTest.doesThrow(() => CustomizableUI.createWidget(brokenSpec),
"Creating non-removable widget without defaultArea should throw.");
// Widget without removable set should be removable:

View File

@ -33,7 +33,7 @@ add_task(function() {
yield PanelUI.show();
yield waitForCondition(function() !feedButton.hasAttribute("disabled"));
yield waitForCondition(() => !feedButton.hasAttribute("disabled"));
ok(!feedButton.hasAttribute("disabled"), "The Subscribe button gets enabled");
feedButton.click();

View File

@ -20,7 +20,7 @@ add_task(function() {
is(undoResetButton.hidden, false, "The undo button is visible after reset");
undoResetButton.click();
yield waitForCondition(function() !gCustomizeMode.resetting);
yield waitForCondition(() => !gCustomizeMode.resetting);
ok(!CustomizableUI.inDefaultState, "Not in default state after reset-undo");
is(undoResetButton.hidden, true, "The undo button is hidden after clicking on the undo button");
is(CustomizableUI.getPlacementOfWidget(homeButtonId), null, "Home button is in palette");

View File

@ -48,7 +48,7 @@ add_task(function* asyncCleanup() {
function mockFunctions() {
// mock needsSetup
gSyncUI._needsSetup = function() Promise.resolve(false);
gSyncUI._needsSetup = () => Promise.resolve(false);
// mock service.errorHandler.syncAndReportErrors()
service.errorHandler.syncAndReportErrors = mocked_syncAndReportErrors;

View File

@ -374,7 +374,7 @@ function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) {
function waitFor(aTimeout=100) {
let deferred = Promise.defer();
setTimeout(function() deferred.resolve(), aTimeout);
setTimeout(() => deferred.resolve(), aTimeout);
return deferred.promise;
}