Created
April 10, 2014 21:12
-
-
Save kdiogenes/10423985 to your computer and use it in GitHub Desktop.
ember-easyForm: test uses the specified model declared in a needs controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('uses the specified model declared in a needs controller', function() { | |
var NeedsController = Ember.ObjectController.extend({ | |
needs: 'another_controller_with_big_name', | |
anotherController: Ember.computed.alias('controllers.another_controller_with_big_name'), | |
container: container | |
}); | |
container.register('controller:another_controller_with_big_name', Ember.ObjectController.create({ | |
theModel: { foo: 'LOL' }, | |
foo: 'BORING' | |
})); | |
var needsController = NeedsController.create(); | |
view = Ember.View.create({ | |
template: templateFor('{{#form-for anotherController.theModel}}{{input foo name="easy-input"}} <div id="asl">{{foo}}</div> {{input id="ember-input" value=foo}}{{/form-for}}'), | |
container: container, | |
controller: needsController | |
}); | |
append(view); | |
equal(view.$('input[name="easy-input"]').val(), "LOL", "easy-input uses form-for's model as its context for looking up its property"); | |
equal(view.$('#ember-input').val(), "BORING", "vanilla ember inputs are unaffected by form-for"); | |
equal(view.$('#asl').text(), "BORING", "form-for doesn't change context for plain ol bindings"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment