From 6486e551beed08f1367552aa491adbfc7a571084 Mon Sep 17 00:00:00 2001 From: Luca Greco Date: Wed, 2 Nov 2016 20:39:07 +0100 Subject: [PATCH] fix: bulk fix call expression params indentation using eslint --- test/test-async-functions.js | 6 ++--- test/test-browser-global.js | 14 ++++++------ test/test-proxied-properties.js | 34 ++++++++++++++-------------- test/test-runtime-onMessage.js | 40 ++++++++++++++++----------------- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/test/test-async-functions.js b/test/test-async-functions.js index 7f14fa4..5c8e8de 100644 --- a/test/test-async-functions.js +++ b/test/test-async-functions.js @@ -39,9 +39,9 @@ describe("browser-polyfill", () => { }).then(results => { equal(results[0], "res1", "Fake alarms.clear call resolved to a single value"); deepEqual(results[1], ["res1", "res2"], - "Fake tabs.query resolved to an array of values"); + "Fake tabs.query resolved to an array of values"); deepEqual(results[2], ["res1", "res2"], - "Fake runtime.requestUpdateCheck resolved to an array of values"); + "Fake runtime.requestUpdateCheck resolved to an array of values"); }); }); @@ -63,7 +63,7 @@ describe("browser-polyfill", () => { return window.browser.tabs.query({active: true}).then( () => fail("Expected a rejected promise"), (err) => equal(err, fakeChrome.runtime.lastError, - "Got the expected error in the rejected promise") + "Got the expected error in the rejected promise") ); }); }); diff --git a/test/test-browser-global.js b/test/test-browser-global.js index 184ff65..b21495d 100644 --- a/test/test-browser-global.js +++ b/test/test-browser-global.js @@ -22,7 +22,7 @@ describe("browser-polyfill", () => { return setupTestDOMWindow(fakeChrome, fakeBrowser).then(window => { deepEqual(window.browser, fakeBrowser, - "The existent browser has not been wrapped"); + "The existent browser has not been wrapped"); }); }); @@ -38,15 +38,15 @@ describe("browser-polyfill", () => { ok("myns" in window.browser, "The custom property exists"); ok("mykey" in window.browser.myns, - "The content of the custom property exists"); + "The content of the custom property exists"); deepEqual(window.browser.myns, {mykey: true}, - "The custom property has the expected content"); + "The custom property has the expected content"); delete window.browser.myns; ok(!("myns" in window.browser), - "The deleted custom defined property has been removed"); + "The deleted custom defined property has been removed"); }); }); @@ -54,11 +54,11 @@ describe("browser-polyfill", () => { const fakeChrome = {myns: {mykey: true}}; return setupTestDOMWindow(fakeChrome).then(window => { equal(window.browser.myns.mykey, true, - "Got the expected result from a wrapped property"); + "Got the expected result from a wrapped property"); equal(window.browser.myns.nonexistent, undefined, - "Got undefined for non existent property"); + "Got undefined for non existent property"); equal(window.browser.nonexistent, undefined, - "Got undefined for non existent namespaces"); + "Got undefined for non existent namespaces"); }); }); }); diff --git a/test/test-proxied-properties.js b/test/test-proxied-properties.js index b033883..589d0f1 100644 --- a/test/test-proxied-properties.js +++ b/test/test-proxied-properties.js @@ -22,7 +22,7 @@ describe("browser-polyfill", () => { const receivedCallback = fakeChrome.runtime.nonwrappedmethod.firstCall.args[0]; equal(fakeCallback, receivedCallback, - "The callback has not been wrapped for the nonwrappedmethod"); + "The callback has not been wrapped for the nonwrappedmethod"); }); }); @@ -37,9 +37,9 @@ describe("browser-polyfill", () => { return setupTestDOMWindow(fakeChrome).then(window => { // Check that the property values on the generated wrapper. equal(window.browser.runtime.myprop, "previous-value", - "Got the expected result from setting a wrapped property name"); + "Got the expected result from setting a wrapped property name"); equal(window.browser.nowrapns.nowrapkey, "previous-value", - "Got the expected result from setting a wrapped property name"); + "Got the expected result from setting a wrapped property name"); // Update the properties on the generated wrapper. const setResult = window.browser.runtime.myprop = "new-value"; @@ -47,30 +47,30 @@ describe("browser-polyfill", () => { // Check the results of setting the new value of the wrapped properties. equal(setResult, "new-value", - "Got the expected result from setting a wrapped property name"); + "Got the expected result from setting a wrapped property name"); equal(setResult2, "new-value", - "Got the expected result from setting a wrapped property name"); + "Got the expected result from setting a wrapped property name"); // Verify that the wrapped properties has been updated. equal(window.browser.runtime.myprop, "new-value", - "Got the expected updated value from the browser property"); + "Got the expected updated value from the browser property"); equal(window.browser.nowrapns.nowrapkey, "new-value", - "Got the expected updated value from the browser property"); + "Got the expected updated value from the browser property"); // Verify that the target properties has been updated. equal(window.chrome.runtime.myprop, "new-value", - "Got the expected updated value on the related chrome property"); + "Got the expected updated value on the related chrome property"); equal(window.chrome.nowrapns.nowrapkey, "new-value", - "Got the expected updated value on the related chrome property"); + "Got the expected updated value on the related chrome property"); // Set a property multiple times before read. window.browser.nowrapns.nowrapkey2 = "new-value2"; window.browser.nowrapns.nowrapkey2 = "new-value3"; equal(window.chrome.nowrapns.nowrapkey2, "new-value3", - "Got the expected updated value on the related chrome property"); + "Got the expected updated value on the related chrome property"); equal(window.browser.nowrapns.nowrapkey2, "new-value3", - "Got the expected updated value on the wrapped property"); + "Got the expected updated value on the wrapped property"); }); }); @@ -83,21 +83,21 @@ describe("browser-polyfill", () => { ok("newns" in window.chrome, "The custom namespace is in the target"); equal(window.browser.newns.newkey, "test-value", - "Got the expected result from setting a wrapped property name"); + "Got the expected result from setting a wrapped property name"); const setRes = window.browser.newns = {newkey2: "new-value"}; equal(window.browser.newns.newkey2, "new-value", - "The new non-wrapped getter is cached"); + "The new non-wrapped getter is cached"); deepEqual(setRes, {newkey2: "new-value"}, - "Got the expected result from setting a new wrapped property name"); + "Got the expected result from setting a new wrapped property name"); deepEqual(window.browser.newns, window.chrome.newns, - "chrome.newns and browser.newns are the same"); + "chrome.newns and browser.newns are the same"); delete window.browser.newns.newkey2; equal(window.browser.newns.newkey2, undefined, - "Got the expected result from setting a wrapped property name"); + "Got the expected result from setting a wrapped property name"); ok(!("newkey2" in window.browser.newns), - "The deleted property is not listed anymore"); + "The deleted property is not listed anymore"); }); }); }); diff --git a/test/test-runtime-onMessage.js b/test/test-runtime-onMessage.js index 2f9146b..5f178fa 100644 --- a/test/test-runtime-onMessage.js +++ b/test/test-runtime-onMessage.js @@ -25,8 +25,8 @@ describe("browser-polyfill", () => { window.browser.runtime.onMessage.addListener(fakeNonFunctionListener); deepEqual(fakeChrome.runtime.onMessage.addListener.firstCall.args[0], - fakeNonFunctionListener, - "The non-function listener has not been wrapped"); + fakeNonFunctionListener, + "The non-function listener has not been wrapped"); }); }); @@ -50,22 +50,22 @@ describe("browser-polyfill", () => { return setupTestDOMWindow(fakeChrome).then(window => { equal(window.browser.runtime.onMessage.hasListener(messageListener), - false, "Got hasListener==false before the listener has been added"); + false, "Got hasListener==false before the listener has been added"); window.browser.runtime.onMessage.addListener(messageListener); equal(window.browser.runtime.onMessage.hasListener(messageListener), - true, "Got hasListener==true once the listener has been added"); + true, "Got hasListener==true once the listener has been added"); // Add the same listener again to test that it will be called with the // same wrapped listener. window.browser.runtime.onMessage.addListener(messageListener); ok(fakeChrome.runtime.onMessage.addListener.calledTwice, - "addListener has been called twice"); + "addListener has been called twice"); equal(fakeChrome.runtime.onMessage.addListener.secondCall.args[0], - fakeChrome.runtime.onMessage.addListener.firstCall.args[0], - "both the addListener calls received the same wrapped listener"); + fakeChrome.runtime.onMessage.addListener.firstCall.args[0], + "both the addListener calls received the same wrapped listener"); // Retrieve the wrapped listener and execute it to fake a received message. const wrappedListener = fakeChrome.runtime.onMessage.addListener.firstCall.args[0]; @@ -75,12 +75,12 @@ describe("browser-polyfill", () => { // Remove the listener. window.browser.runtime.onMessage.removeListener(messageListener); ok(fakeChrome.runtime.onMessage.removeListener.calledOnce, - "removeListener has been called once"); + "removeListener has been called once"); equal(fakeChrome.runtime.onMessage.addListener.secondCall.args[0], - fakeChrome.runtime.onMessage.removeListener.firstCall.args[0], - "both the addListener and removeListenercalls received the same wrapped listener"); + fakeChrome.runtime.onMessage.removeListener.firstCall.args[0], + "both the addListener and removeListenercalls received the same wrapped listener"); equal(fakeChrome.runtime.onMessage.hasListener(messageListener), false, - "Got hasListener==false once the listener has been removed"); + "Got hasListener==false once the listener has been removed"); }); }); @@ -123,11 +123,11 @@ describe("browser-polyfill", () => { ok(messageListener.calledOnce, "The unwrapped message listener has been called"); deepEqual(messageListener.firstCall.args, ["fake message", {name: "fake sender"}], - "The unwrapped message listener has received the expected parameters"); + "The unwrapped message listener has received the expected parameters"); ok(sendResponseSpy.calledOnce, "The sendResponse function has been called"); equal(sendResponseSpy.firstCall.args[0], "fake reply", - "sendResponse callback has been called with the expected parameters"); + "sendResponse callback has been called with the expected parameters"); wrappedListener("fake message2", {name: "fake sender2"}, sendResponseSpy); @@ -135,29 +135,29 @@ describe("browser-polyfill", () => { return secondResponse; }).then(() => { ok(messageListener.calledTwice, - "The unwrapped message listener has been called"); + "The unwrapped message listener has been called"); deepEqual(messageListener.secondCall.args, ["fake message2", {name: "fake sender2"}], - "The unwrapped listener has received the expected parameters"); + "The unwrapped listener has received the expected parameters"); ok(sendResponseSpy.calledTwice, "The sendResponse function has been called"); equal(sendResponseSpy.secondCall.args[0], "fake reply 2", - "sendResponse callback has been called with the expected parameters"); + "sendResponse callback has been called with the expected parameters"); }).then(() => { wrappedListener("fake message3", {name: "fake sender3"}, sendResponseSpy); // Wait the third response promise to be rejected. return thirdResponse.catch(err => { equal(messageListener.callCount, 3, - "The unwrapped message listener has been called"); + "The unwrapped message listener has been called"); deepEqual(messageListener.thirdCall.args, ["fake message3", {name: "fake sender3"}], - "The unwrapped listener has received the expected parameters"); + "The unwrapped listener has received the expected parameters"); equal(sendResponseSpy.callCount, 3, - "The sendResponse function has been called"); + "The sendResponse function has been called"); equal(sendResponseSpy.thirdCall.args[0], err, - "sendResponse callback has been called with the expected parameters"); + "sendResponse callback has been called with the expected parameters"); }); }); });