Skip to content

Commit

Permalink
Merge pull request #48 from rwjblue/allow-missing-callbacks-for-compo…
Browse files Browse the repository at this point in the history
…nents

Allow missing arguments for `moduleForComponent`.
  • Loading branch information
rwjblue committed May 14, 2015
2 parents 0a514b2 + ef2df07 commit 05e932d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ember-test-helpers/test-module-for-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export default TestModule.extend({
init: function(componentName, description, callbacks) {
// Allow `description` to be omitted
if (!callbacks && typeof description === 'object') {
callbacks = description || {};
callbacks = description;
description = null;
} else if (!callbacks && !description) {
callbacks = {};
}

this.componentName = componentName;
Expand Down
18 changes: 18 additions & 0 deletions tests/test-module-for-component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,21 @@ test("className", function(){
expect(1)
// the assertion is in the willDestroyElement() hook of the component
});

var testModule;
module('moduleForComponent: can be invoked with only the component name', {
beforeEach: function(assert) {
var done = assert.async();
testModule = new TestModuleForComponent('pretty-color');
testModule.setup()['finally'](done);
},

afterEach: function(assert) {
var done = assert.async();
testModule.teardown()['finally'](done);
}
});

test('it allows missing callbacks', function() {
ok(true, 'no errors are thrown');
});

0 comments on commit 05e932d

Please sign in to comment.