2015-07-14 13:56:59 -04:00
|
|
|
import componentTest from 'helpers/component-test';
|
2015-06-09 12:19:41 -04:00
|
|
|
moduleForComponent('value-list', {integration: true});
|
|
|
|
|
2015-07-14 13:56:59 -04:00
|
|
|
componentTest('functionality', {
|
|
|
|
template: '{{value-list value=values}}',
|
|
|
|
test: function(assert) {
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(this.$('.values .value').length === 0, 'it has no values');
|
|
|
|
assert.ok(this.$('input').length, 'it renders the input');
|
|
|
|
assert.ok(this.$('.btn-primary[disabled]').length, 'it is disabled with no value');
|
|
|
|
});
|
2015-06-09 12:19:41 -04:00
|
|
|
|
2015-07-14 13:56:59 -04:00
|
|
|
fillIn('input', 'eviltrout');
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(!this.$('.btn-primary[disabled]').length, "it isn't disabled anymore");
|
|
|
|
});
|
2015-06-09 12:19:41 -04:00
|
|
|
|
2015-07-14 13:56:59 -04:00
|
|
|
click('.btn-primary');
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(this.$('.values .value').length === 1, 'it adds the value');
|
|
|
|
assert.ok(this.$('input').val() === '', 'it clears the input');
|
|
|
|
assert.ok(this.$('.btn-primary[disabled]').length, "it is disabled again");
|
|
|
|
});
|
2015-06-09 12:19:41 -04:00
|
|
|
|
2015-07-14 13:56:59 -04:00
|
|
|
click('.value .btn-small');
|
|
|
|
andThen(() => {
|
|
|
|
assert.ok(this.$('.values .value').length === 0, 'it removes the value');
|
|
|
|
});
|
|
|
|
}
|
2015-06-09 12:19:41 -04:00
|
|
|
});
|