aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng')
-rw-r--r--test/ng/directive/inputSpec.js16
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();
+ });
});
});