diff options
| author | Misko Hevery | 2012-05-25 10:29:54 -0700 |
|---|---|---|
| committer | Misko Hevery | 2012-06-02 16:02:09 -0700 |
| commit | 8024a5742c46a42ef204988ff7362a4fc14b7a2d (patch) | |
| tree | fc8e4dcae5e84ad462ba5f06bd7f0389590e3a1b /test/ng/directive/inputSpec.js | |
| parent | 073e76f8353ca3f743ea61ff21f7de7b1e5a7701 (diff) | |
| download | angular.js-8024a5742c46a42ef204988ff7362a4fc14b7a2d.tar.bz2 | |
doc(NgModelController) add example and $render documentation
Closes#930
Diffstat (limited to 'test/ng/directive/inputSpec.js')
| -rw-r--r-- | test/ng/directive/inputSpec.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index 45e3e1bf..d7ca7aea 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -285,8 +285,9 @@ describe('input', function() { var formElm, inputElm, scope, $compile, changeInputValueTo; function compileInput(inputHtml) { - formElm = jqLite('<form name="form">' + inputHtml + '</form>'); - inputElm = formElm.find('input'); + inputElm = jqLite(inputHtml); + formElm = jqLite('<form name="form"></form>'); + formElm.append(inputElm); $compile(formElm)(scope); } @@ -633,6 +634,17 @@ describe('input', function() { expect(inputElm.val()).toBe('0') expect(scope.form.alias.$error.required).toBeFalsy(); }); + + it('should register required on non boolean elements', function() { + compileInput('<div ng-model="value" name="alias" required>'); + + scope.$apply(function() { + scope.value = ''; + }); + + expect(inputElm).toBeInvalid(); + expect(scope.form.alias.$error.required).toBeTruthy(); + }); }); }); |
