fix: bulk fix call expression params indentation using eslint
This commit is contained in:
parent
de50f2047d
commit
6486e551be
|
@ -39,9 +39,9 @@ describe("browser-polyfill", () => {
|
||||||
}).then(results => {
|
}).then(results => {
|
||||||
equal(results[0], "res1", "Fake alarms.clear call resolved to a single value");
|
equal(results[0], "res1", "Fake alarms.clear call resolved to a single value");
|
||||||
deepEqual(results[1], ["res1", "res2"],
|
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"],
|
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(
|
return window.browser.tabs.query({active: true}).then(
|
||||||
() => fail("Expected a rejected promise"),
|
() => fail("Expected a rejected promise"),
|
||||||
(err) => equal(err, fakeChrome.runtime.lastError,
|
(err) => equal(err, fakeChrome.runtime.lastError,
|
||||||
"Got the expected error in the rejected promise")
|
"Got the expected error in the rejected promise")
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe("browser-polyfill", () => {
|
||||||
|
|
||||||
return setupTestDOMWindow(fakeChrome, fakeBrowser).then(window => {
|
return setupTestDOMWindow(fakeChrome, fakeBrowser).then(window => {
|
||||||
deepEqual(window.browser, fakeBrowser,
|
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("myns" in window.browser, "The custom property exists");
|
||||||
ok("mykey" in window.browser.myns,
|
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},
|
deepEqual(window.browser.myns, {mykey: true},
|
||||||
"The custom property has the expected content");
|
"The custom property has the expected content");
|
||||||
|
|
||||||
delete window.browser.myns;
|
delete window.browser.myns;
|
||||||
|
|
||||||
ok(!("myns" in window.browser),
|
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}};
|
const fakeChrome = {myns: {mykey: true}};
|
||||||
return setupTestDOMWindow(fakeChrome).then(window => {
|
return setupTestDOMWindow(fakeChrome).then(window => {
|
||||||
equal(window.browser.myns.mykey, true,
|
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,
|
equal(window.browser.myns.nonexistent, undefined,
|
||||||
"Got undefined for non existent property");
|
"Got undefined for non existent property");
|
||||||
equal(window.browser.nonexistent, undefined,
|
equal(window.browser.nonexistent, undefined,
|
||||||
"Got undefined for non existent namespaces");
|
"Got undefined for non existent namespaces");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,7 +22,7 @@ describe("browser-polyfill", () => {
|
||||||
const receivedCallback = fakeChrome.runtime.nonwrappedmethod.firstCall.args[0];
|
const receivedCallback = fakeChrome.runtime.nonwrappedmethod.firstCall.args[0];
|
||||||
|
|
||||||
equal(fakeCallback, receivedCallback,
|
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 => {
|
return setupTestDOMWindow(fakeChrome).then(window => {
|
||||||
// Check that the property values on the generated wrapper.
|
// Check that the property values on the generated wrapper.
|
||||||
equal(window.browser.runtime.myprop, "previous-value",
|
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",
|
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.
|
// Update the properties on the generated wrapper.
|
||||||
const setResult = window.browser.runtime.myprop = "new-value";
|
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.
|
// Check the results of setting the new value of the wrapped properties.
|
||||||
equal(setResult, "new-value",
|
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",
|
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.
|
// Verify that the wrapped properties has been updated.
|
||||||
equal(window.browser.runtime.myprop, "new-value",
|
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",
|
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.
|
// Verify that the target properties has been updated.
|
||||||
equal(window.chrome.runtime.myprop, "new-value",
|
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",
|
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.
|
// Set a property multiple times before read.
|
||||||
window.browser.nowrapns.nowrapkey2 = "new-value2";
|
window.browser.nowrapns.nowrapkey2 = "new-value2";
|
||||||
window.browser.nowrapns.nowrapkey2 = "new-value3";
|
window.browser.nowrapns.nowrapkey2 = "new-value3";
|
||||||
|
|
||||||
equal(window.chrome.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",
|
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");
|
ok("newns" in window.chrome, "The custom namespace is in the target");
|
||||||
|
|
||||||
equal(window.browser.newns.newkey, "test-value",
|
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"};
|
const setRes = window.browser.newns = {newkey2: "new-value"};
|
||||||
equal(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"},
|
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,
|
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;
|
delete window.browser.newns.newkey2;
|
||||||
equal(window.browser.newns.newkey2, undefined,
|
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),
|
ok(!("newkey2" in window.browser.newns),
|
||||||
"The deleted property is not listed anymore");
|
"The deleted property is not listed anymore");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -25,8 +25,8 @@ describe("browser-polyfill", () => {
|
||||||
window.browser.runtime.onMessage.addListener(fakeNonFunctionListener);
|
window.browser.runtime.onMessage.addListener(fakeNonFunctionListener);
|
||||||
|
|
||||||
deepEqual(fakeChrome.runtime.onMessage.addListener.firstCall.args[0],
|
deepEqual(fakeChrome.runtime.onMessage.addListener.firstCall.args[0],
|
||||||
fakeNonFunctionListener,
|
fakeNonFunctionListener,
|
||||||
"The non-function listener has not been wrapped");
|
"The non-function listener has not been wrapped");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -50,22 +50,22 @@ describe("browser-polyfill", () => {
|
||||||
|
|
||||||
return setupTestDOMWindow(fakeChrome).then(window => {
|
return setupTestDOMWindow(fakeChrome).then(window => {
|
||||||
equal(window.browser.runtime.onMessage.hasListener(messageListener),
|
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);
|
window.browser.runtime.onMessage.addListener(messageListener);
|
||||||
|
|
||||||
equal(window.browser.runtime.onMessage.hasListener(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
|
// Add the same listener again to test that it will be called with the
|
||||||
// same wrapped listener.
|
// same wrapped listener.
|
||||||
window.browser.runtime.onMessage.addListener(messageListener);
|
window.browser.runtime.onMessage.addListener(messageListener);
|
||||||
|
|
||||||
ok(fakeChrome.runtime.onMessage.addListener.calledTwice,
|
ok(fakeChrome.runtime.onMessage.addListener.calledTwice,
|
||||||
"addListener has been called twice");
|
"addListener has been called twice");
|
||||||
equal(fakeChrome.runtime.onMessage.addListener.secondCall.args[0],
|
equal(fakeChrome.runtime.onMessage.addListener.secondCall.args[0],
|
||||||
fakeChrome.runtime.onMessage.addListener.firstCall.args[0],
|
fakeChrome.runtime.onMessage.addListener.firstCall.args[0],
|
||||||
"both the addListener calls received the same wrapped listener");
|
"both the addListener calls received the same wrapped listener");
|
||||||
|
|
||||||
// Retrieve the wrapped listener and execute it to fake a received message.
|
// Retrieve the wrapped listener and execute it to fake a received message.
|
||||||
const wrappedListener = fakeChrome.runtime.onMessage.addListener.firstCall.args[0];
|
const wrappedListener = fakeChrome.runtime.onMessage.addListener.firstCall.args[0];
|
||||||
|
@ -75,12 +75,12 @@ describe("browser-polyfill", () => {
|
||||||
// Remove the listener.
|
// Remove the listener.
|
||||||
window.browser.runtime.onMessage.removeListener(messageListener);
|
window.browser.runtime.onMessage.removeListener(messageListener);
|
||||||
ok(fakeChrome.runtime.onMessage.removeListener.calledOnce,
|
ok(fakeChrome.runtime.onMessage.removeListener.calledOnce,
|
||||||
"removeListener has been called once");
|
"removeListener has been called once");
|
||||||
equal(fakeChrome.runtime.onMessage.addListener.secondCall.args[0],
|
equal(fakeChrome.runtime.onMessage.addListener.secondCall.args[0],
|
||||||
fakeChrome.runtime.onMessage.removeListener.firstCall.args[0],
|
fakeChrome.runtime.onMessage.removeListener.firstCall.args[0],
|
||||||
"both the addListener and removeListenercalls received the same wrapped listener");
|
"both the addListener and removeListenercalls received the same wrapped listener");
|
||||||
equal(fakeChrome.runtime.onMessage.hasListener(messageListener), false,
|
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");
|
ok(messageListener.calledOnce, "The unwrapped message listener has been called");
|
||||||
deepEqual(messageListener.firstCall.args,
|
deepEqual(messageListener.firstCall.args,
|
||||||
["fake message", {name: "fake sender"}],
|
["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");
|
ok(sendResponseSpy.calledOnce, "The sendResponse function has been called");
|
||||||
equal(sendResponseSpy.firstCall.args[0], "fake reply",
|
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);
|
wrappedListener("fake message2", {name: "fake sender2"}, sendResponseSpy);
|
||||||
|
|
||||||
|
@ -135,29 +135,29 @@ describe("browser-polyfill", () => {
|
||||||
return secondResponse;
|
return secondResponse;
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
ok(messageListener.calledTwice,
|
ok(messageListener.calledTwice,
|
||||||
"The unwrapped message listener has been called");
|
"The unwrapped message listener has been called");
|
||||||
deepEqual(messageListener.secondCall.args,
|
deepEqual(messageListener.secondCall.args,
|
||||||
["fake message2", {name: "fake sender2"}],
|
["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");
|
ok(sendResponseSpy.calledTwice, "The sendResponse function has been called");
|
||||||
equal(sendResponseSpy.secondCall.args[0], "fake reply 2",
|
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(() => {
|
}).then(() => {
|
||||||
wrappedListener("fake message3", {name: "fake sender3"}, sendResponseSpy);
|
wrappedListener("fake message3", {name: "fake sender3"}, sendResponseSpy);
|
||||||
|
|
||||||
// Wait the third response promise to be rejected.
|
// Wait the third response promise to be rejected.
|
||||||
return thirdResponse.catch(err => {
|
return thirdResponse.catch(err => {
|
||||||
equal(messageListener.callCount, 3,
|
equal(messageListener.callCount, 3,
|
||||||
"The unwrapped message listener has been called");
|
"The unwrapped message listener has been called");
|
||||||
deepEqual(messageListener.thirdCall.args,
|
deepEqual(messageListener.thirdCall.args,
|
||||||
["fake message3", {name: "fake sender3"}],
|
["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,
|
equal(sendResponseSpy.callCount, 3,
|
||||||
"The sendResponse function has been called");
|
"The sendResponse function has been called");
|
||||||
equal(sendResponseSpy.thirdCall.args[0], err,
|
equal(sendResponseSpy.thirdCall.args[0], err,
|
||||||
"sendResponse callback has been called with the expected parameters");
|
"sendResponse callback has been called with the expected parameters");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue