diff options
Diffstat (limited to 'src/ng/directive/form.js')
| -rw-r--r-- | src/ng/directive/form.js | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js index 06ffad86..86776ae7 100644 --- a/src/ng/directive/form.js +++ b/src/ng/directive/form.js @@ -305,18 +305,27 @@ function FormController(element, attrs) { <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br> </form> </doc:source> - <doc:scenario> + <doc:protractor> it('should initialize to model', function() { - expect(binding('userType')).toEqual('guest'); - expect(binding('myForm.input.$valid')).toEqual('true'); + var userType = element(by.binding('userType')); + var valid = element(by.binding('myForm.input.$valid')); + + expect(userType.getText()).toContain('guest'); + expect(valid.getText()).toContain('true'); }); it('should be invalid if empty', function() { - input('userType').enter(''); - expect(binding('userType')).toEqual(''); - expect(binding('myForm.input.$valid')).toEqual('false'); + var userType = element(by.binding('userType')); + var valid = element(by.binding('myForm.input.$valid')); + var userInput = element(by.model('userType')); + + userInput.clear(); + userInput.sendKeys(''); + + expect(userType.getText()).toEqual('userType ='); + expect(valid.getText()).toContain('false'); }); - </doc:scenario> + </doc:protractor> </doc:example> */ var formDirectiveFactory = function(isNgForm) { |
