2015-10-16 11:21:06 +02:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
|
|
|
export default Ember.Test.registerHelper('pollHasAnswers', function(app, assert, answers) {
|
2016-01-28 12:34:56 +01:00
|
|
|
const [ elBase ] = find('.participation .selections .form-group');
|
2015-10-16 11:21:06 +02:00
|
|
|
assert.equal(
|
2015-11-12 15:52:14 +01:00
|
|
|
find('.radio label', elBase).length,
|
2015-10-16 11:21:06 +02:00
|
|
|
answers.length,
|
|
|
|
'poll has expected count of answers'
|
|
|
|
);
|
|
|
|
answers.forEach((answer, index) => {
|
|
|
|
assert.equal(
|
2016-01-28 12:34:56 +01:00
|
|
|
find(`.radio:nth-child(${index + 1}) label`, elBase).text().trim(),
|
2015-10-16 11:21:06 +02:00
|
|
|
answer,
|
2016-01-28 12:34:56 +01:00
|
|
|
`poll answer ${index} is as expected`
|
2015-10-16 11:21:06 +02:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|