Upgrade ember qunit, create new interface for testing components

This commit is contained in:
Robin Ward
2015-07-14 13:56:59 -04:00
parent 1397507d05
commit 7a58d64f37
7 changed files with 162 additions and 146 deletions

View File

@ -1,31 +1,30 @@
import componentTest from 'helpers/component-test';
moduleForComponent('value-list', {integration: true});
test('functionality', function(assert) {
andThen(() => {
this.render('{{value-list value=values}}');
});
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');
});
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');
});
fillIn('input', 'eviltrout');
andThen(() => {
assert.ok(!this.$('.btn-primary[disabled]').length, "it isn't disabled anymore");
});
fillIn('input', 'eviltrout');
andThen(() => {
assert.ok(!this.$('.btn-primary[disabled]').length, "it isn't disabled anymore");
});
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");
});
click('.value .btn-small');
andThen(() => {
assert.ok(this.$('.values .value').length === 0, 'it removes the value');
});
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");
});
click('.value .btn-small');
andThen(() => {
assert.ok(this.$('.values .value').length === 0, 'it removes the value');
});
}
});