decide.nolog.cz/tests/helpers/poll-participate.js
jelhan 01f9b6e61f extract participation form from participants table and make it a bootstrap form
started replacing ember-easy-form-extensions by ember-form-master-2000
and ember-validations by ember-cp-validations

using ember-form-master-2000 in old 0.2 release cause newer releases does not work with ember 0.12
should move to ember 2.x as soon as possible
therefore ember-easy-form-extensions has to be dropped and ember-i18n been updated

part of #76
2015-11-12 15:52:14 +01:00

20 lines
729 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);
}
var 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"]');
});