Prettify codebase

This commit is contained in:
2020-06-25 23:31:51 +02:00
parent 236ab22e12
commit 818382bd13
17 changed files with 102 additions and 94 deletions

View File

@ -13,22 +13,22 @@
*/
exports.assertion = function elementCount(selectorOrObject, count) {
let selector;
let selector
// when called from a page object element or section
if (typeof selectorOrObject === "object" && selectorOrObject.selector) {
if (typeof selectorOrObject === 'object' && selectorOrObject.selector) {
// eslint-disable-next-line prefer-destructuring
selector = selectorOrObject.selector;
selector = selectorOrObject.selector
} else {
selector = selectorOrObject;
selector = selectorOrObject
}
this.message = `Testing if element <${selector}> has count: ${count}`;
this.expected = count;
this.pass = val => val === count;
this.value = res => res.value;
this.message = `Testing if element <${selector}> has count: ${count}`
this.expected = count
this.pass = (val) => val === count
this.value = (res) => res.value
function evaluator(_selector) {
return document.querySelectorAll(_selector).length;
return document.querySelectorAll(_selector).length
}
this.command = cb => this.api.execute(evaluator, [selector], cb);
};
this.command = (cb) => this.api.execute(evaluator, [selector], cb)
}