decide.nolog.cz/tests/helpers/poll-participate.js

21 lines
697 B
JavaScript
Raw Normal View History

import Ember from 'ember';
export default Ember.Test.registerAsyncHelper('pollParticipate', function(app, name, selections) {
if (!Ember.isEmpty(name)) {
2016-05-28 01:04:21 +02:00
fillIn('.participation .name input', name);
}
2016-01-28 11:27:00 +01:00
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 {
2017-07-31 18:47:38 +02:00
click(`.participation .selections .form-group:nth-child(${index + 1}) .${selection}.radio input`);
}
}
});
click('.participation button[type="submit"]');
});