decide.nolog.cz/tests/helpers/poll-participate.js
jelhan 682e6a658e fix coding style errors
> helpers/poll-has-users.js should pass jscs.
> requireSemicolons: Missing semicolon after statement at helpers/poll-has-users.js
is incostitent with JSHint which complains about this semicolon

other ones should be fixed by rewrite of create/options
2016-01-28 12:34:56 +01:00

20 lines
712 B
JavaScript

import Ember from 'ember';
export default Ember.Test.registerAsyncHelper('pollParticipate', function(app, name, selections) {
if (!Ember.isEmpty(name)) {
fillIn('.participation input#Name', name);
}
const isFreeText = find('.participation .selections .radio').length ? false : true;
selections.forEach((selection, index) => {
if (!Ember.isEmpty(selection)) {
if (isFreeText) {
fillIn(`.participation .selections .form-group:nth-child(${index + 1}) input`, selection);
} else {
click(`.participation .selections .form-group:nth-child(${index + 1}) input[type="radio"][value="${selection}"]`);
}
}
});
click('.participation button[type="submit"]');
});