98ff62af80
* Update dependency prettier to v3 * upgrade eslint-plugin-prettier and run prettier on all files --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jeldrik Hanschke <admin@jhanschke.de>
29 lines
823 B
JavaScript
29 lines
823 B
JavaScript
import { isEmpty } from '@ember/utils';
|
|
import { findAll } from '@ember/test-helpers';
|
|
|
|
function pollHasUser(assert, name, selections) {
|
|
let elBase = findAll('.user').find((el) => {
|
|
return el.querySelector('td:nth-child(1)').textContent.trim() === name;
|
|
});
|
|
assert.ok(elBase, `user ${name} exists`);
|
|
|
|
if (elBase) {
|
|
selections.forEach((selection, index) => {
|
|
assert.equal(
|
|
elBase.querySelector(`td:nth-child(${index + 2})`).textContent.trim(),
|
|
selection.toString(),
|
|
`selection ${index} is as expected`,
|
|
);
|
|
});
|
|
}
|
|
}
|
|
|
|
function pollHasUsersCount(assert, count, message) {
|
|
if (isEmpty(message)) {
|
|
message = 'poll has expected count of users';
|
|
}
|
|
assert.equal(findAll('.user').length, count, message);
|
|
}
|
|
|
|
export default pollHasUser;
|
|
export { pollHasUsersCount };
|