Skip to content

Commit

Permalink
Return passed in value for set and setProperties in integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Trent Willis committed Dec 11, 2015
1 parent b632138 commit 720f080
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/ember-test-helpers/test-module-for-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,16 @@ export default TestModule.extend({
};

context.set = function(key, value) {
Ember.run(function() {
Ember.set(context, key, value);
return Ember.run(function() {
return Ember.set(context, key, value);
});
};

context.setProperties = function(hash) {
Ember.run(function() {
Ember.setProperties(context, hash);
});
return hash;
};

context.get = function(key) {
Expand Down
10 changes: 6 additions & 4 deletions tests/test-module-for-integration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function moduleForComponent(name, description, callbacks) {
qunitModuleFor(module);
}


moduleForComponent('Component Integration Tests', {
integration: true,
beforeSetup: function() {
Expand Down Expand Up @@ -157,19 +156,22 @@ moduleForComponent('Component Integration Tests: context', {
});

test('it can set and get properties', function() {
this.set('foo', 1);
var setResult = this.set('foo', 1);
this.render('{{my-component foo=foo}}');
equal(setResult, '1');
equal(this.get('foo'), '1');
equal(this.$('.foo').text(), '1');
});

test('it can setProperties and getProperties', function() {
this.setProperties({
var hash = {
foo: 1,
bar: 2
});
};
var setResult = this.setProperties(hash);
this.render('{{my-component foo=foo bar=bar}}');
var properties = this.getProperties('foo', 'bar');
deepEqual(setResult, hash);
equal(properties.foo, '1');
equal(properties.bar, '2');
equal(this.$('.foo').text(), '1');
Expand Down

0 comments on commit 720f080

Please sign in to comment.