Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 4755a35

Browse files
committed
test(input): clarify a test's description and expectations
The test ensures that when the trueValue is a string, the required error is removed, not that the model is set to the trueValue.
1 parent b2f8b0b commit 4755a35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/ng/directive/inputSpec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -2683,14 +2683,17 @@ describe('input', function() {
26832683
});
26842684

26852685

2686-
it('should set the ngTrueValue when required directive is present', function() {
2687-
var inputElm = helper.compileInput('<input type="checkbox" ng-model="value" required ng-true-value="\'yes\'" />');
2686+
it('should pass validation for "required" when trueValue is a string', function() {
2687+
var inputElm = helper.compileInput('<input type="checkbox" required name="cb"' +
2688+
'ng-model="value" ng-true-value="\'yes\'" />');
26882689

26892690
expect(inputElm).toBeInvalid();
2691+
expect($rootScope.form.cb.$error.required).toBe(true);
26902692

26912693
browserTrigger(inputElm, 'click');
26922694
expect(inputElm[0].checked).toBe(true);
26932695
expect(inputElm).toBeValid();
2696+
expect($rootScope.form.cb.$error.required).toBeUndefined();
26942697
});
26952698
});
26962699

0 commit comments

Comments
 (0)