Skip to content

Commit

Permalink
use assert.async for test instead of promise
Browse files Browse the repository at this point in the history
  • Loading branch information
toddjordan committed Jan 13, 2016
1 parent 0feb9e4 commit 42d54bd
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions tests/integration/components/dynamic-form-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,25 @@ moduleForComponent('/dynamic-form', 'Integration | Component | dynamic-form:basi
});

test('should render form from valid schema object', function (assert) {
return new Ember.RSVP.Promise((resolve) => {
basicObject["postRender"] = () => {
assert.ok(this.$('.alpaca-field-text input').length, 'input field exists');
assert.ok(this.$('.alpaca-field-radio').length, 'radio group exists');
resolve();
};
this.set('basicObject', basicObject);
this.render(hbs`{{dynamic-form schema=basicObject}}`);
});
const done = assert.async();
basicObject["postRender"] = () => {
assert.ok(this.$('.alpaca-field-text input').length, 'input field exists');
assert.ok(this.$('.alpaca-field-radio').length, 'radio group exists');
done();
};
this.set('basicObject', basicObject);
this.render(hbs`{{dynamic-form schema=basicObject}}`);
});

test('should render form from valid schema string', function (assert) {
return new Ember.RSVP.Promise((resolve) => {
const postRenderFn = () => {
assert.ok(this.$('.alpaca-field-text input').length, 'input field exists');
assert.ok(this.$('.alpaca-field-radio').length, 'radio group exists');
resolve();
};
const basicString = JSON.stringify(basicObject);
this.set('postRenderFn', postRenderFn);
this.set('basicString', basicString);
this.render(hbs`{{dynamic-form schema=basicString postRender=postRenderFn}}`);
});
const done = assert.async();
const postRenderFn = () => {
assert.ok(this.$('.alpaca-field-text input').length, 'input field exists');
assert.ok(this.$('.alpaca-field-radio').length, 'radio group exists');
done();
};
const basicString = JSON.stringify(basicObject);
this.set('postRenderFn', postRenderFn);
this.set('basicString', basicString);
this.render(hbs`{{dynamic-form schema=basicString postRender=postRenderFn}}`);
});

0 comments on commit 42d54bd

Please sign in to comment.