decide.nolog.cz/tests/helpers/poll-participate.js
jelhan bb160cc503
refactor participants table (#164)
- Drops floatthead and additional scrollbar
- Makes header and first column sticky
- Refactors code for readability

Sticky header is only working in Firefox. Chrome and Edge does not support `position: sticky` for `<thead>`. Haven't tested Safari.
2019-04-20 23:29:59 +02:00

23 lines
779 B
JavaScript

import { isEmpty } from '@ember/utils';
import { findAll, fillIn, click, settled } from '@ember/test-helpers';
export default async function(name, selections) {
if (!isEmpty(name)) {
await fillIn('.participation .name input', name);
}
const isFreeText = findAll('.participation .selections .radio').length > 0 ? false : true;
for (let [index, selection] of selections.entries()) {
if (!isEmpty(selection)) {
if (isFreeText) {
await fillIn(`.participation .selections .form-group:nth-child(${index + 1}) input`, selection);
} else {
await click(`.participation .selections .form-group:nth-child(${index + 1}) .${selection}.radio input`);
}
}
}
await click('.participation button[type="submit"]');
await settled();
}