Skip to content

Commit d763b84

Browse files
committed
chore(deps): electron@11, latest others
- reformatted lib using latest prettier. - added missing awaits to tests. - removed unused tslint and deprecated (no longer needed) eslint-plugin-standard.
1 parent 2bfc7dd commit d763b84

13 files changed

+1706
-3239
lines changed

.eslintrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
{
3232
"files": "*.d.ts",
3333
"rules": {
34-
"no-useless-constructor": "off"
35-
}
34+
"no-useless-constructor": "off",
35+
"no-undef": "off"
36+
}
3637
}
3738
]
3839
}

lib/api.js

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -440,23 +440,23 @@ Api.prototype.addExecuteJavaScriptSupport = function () {
440440
const app = this.app;
441441
const self = this;
442442

443-
app.client.addCommand('webContents.executeJavaScript', function (
444-
code,
445-
useGesture
446-
) {
447-
return this.executeAsync(
448-
async function (code, useGesture, requireName, done) {
449-
const webContents = window[requireName](
450-
'electron'
451-
).remote.getCurrentWebContents();
452-
const result = await webContents.executeJavaScript(code, useGesture);
453-
done(result);
454-
},
455-
code,
456-
useGesture,
457-
self.requireName
458-
);
459-
});
443+
app.client.addCommand(
444+
'webContents.executeJavaScript',
445+
function (code, useGesture) {
446+
return this.executeAsync(
447+
async function (code, useGesture, requireName, done) {
448+
const webContents = window[requireName](
449+
'electron'
450+
).remote.getCurrentWebContents();
451+
const result = await webContents.executeJavaScript(code, useGesture);
452+
done(result);
453+
},
454+
code,
455+
useGesture,
456+
self.requireName
457+
);
458+
}
459+
);
460460

461461
app.webContents.executeJavaScript = function () {
462462
return app.client['webContents.executeJavaScript'].apply(
@@ -492,12 +492,13 @@ Api.prototype.transferPromiseness = function (target, promise) {
492492
const addProperties = function (source, target, moduleName) {
493493
const sourceModule = source[moduleName];
494494
if (!sourceModule) return;
495-
target[moduleName] = transformObject(sourceModule, {}, function (
496-
value,
497-
parent
498-
) {
499-
return value.bind(parent);
500-
});
495+
target[moduleName] = transformObject(
496+
sourceModule,
497+
{},
498+
function (value, parent) {
499+
return value.bind(parent);
500+
}
501+
);
501502
};
502503

503504
addProperties(promise, target, 'webContents');

lib/application.js

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -227,33 +227,32 @@ Application.prototype.createClient = function () {
227227
};
228228

229229
Application.prototype.addCommands = function () {
230-
this.client.addCommand('waitUntilTextExists', function (
231-
selector,
232-
text,
233-
timeout
234-
) {
235-
const self = this;
236-
return self
237-
.waitUntil(async function () {
238-
const elem = await self.$(selector);
239-
const exists = await elem.isExisting();
240-
if (!exists) {
241-
return false;
242-
}
243-
244-
const selectorText = await elem.getText();
245-
return Array.isArray(selectorText)
246-
? selectorText.some((s) => s.includes(text))
247-
: selectorText.includes(text);
248-
}, timeout)
249-
.then(
250-
function () {},
251-
function (error) {
252-
error.message = 'waitUntilTextExists ' + error.message;
253-
throw error;
254-
}
255-
);
256-
});
230+
this.client.addCommand(
231+
'waitUntilTextExists',
232+
function (selector, text, timeout) {
233+
const self = this;
234+
return self
235+
.waitUntil(async function () {
236+
const elem = await self.$(selector);
237+
const exists = await elem.isExisting();
238+
if (!exists) {
239+
return false;
240+
}
241+
242+
const selectorText = await elem.getText();
243+
return Array.isArray(selectorText)
244+
? selectorText.some((s) => s.includes(text))
245+
: selectorText.includes(text);
246+
}, timeout)
247+
.then(
248+
function () {},
249+
function (error) {
250+
error.message = 'waitUntilTextExists ' + error.message;
251+
throw error;
252+
}
253+
);
254+
}
255+
);
257256

258257
this.client.addCommand('waitUntilWindowLoaded', function (timeout) {
259258
const self = this;

0 commit comments

Comments
 (0)