mobilizon/js/tests/e2e/custom-assertions/elementCount.js
Thomas Citharel 8dc5b8a4b0
Fix lint issues
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-12-14 10:21:04 +01:00

14 lines
506 B
JavaScript

export default class ElementCount {
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
constructor(selector, count) {
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;
}
this.command = (cb) => this.api.execute(evaluator, [selector], cb);
}
}