mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-27 19:50:23 +00:00
fix(input): Render 0 (number) as 0 (not empty string)
This commit is contained in:
parent
c4c60c25b4
commit
e7d6106811
2 changed files with 11 additions and 1 deletions
|
|
@ -382,7 +382,7 @@ function textInputType(scope, element, attr, ctrl) {
|
|||
});
|
||||
|
||||
ctrl.render = function() {
|
||||
element.val(ctrl.viewValue || '');
|
||||
element.val(isEmpty(ctrl.viewValue) ? '' : ctrl.viewValue);
|
||||
};
|
||||
|
||||
// pattern validator
|
||||
|
|
|
|||
|
|
@ -334,6 +334,16 @@ describe('input', function() {
|
|||
});
|
||||
|
||||
|
||||
it('should render 0 even if it is a number', function() {
|
||||
compileInput('<input type="text" ng:model="value" />');
|
||||
scope.$apply(function() {
|
||||
scope.value = 0;
|
||||
});
|
||||
|
||||
expect(inputElm.val()).toBe('0');
|
||||
});
|
||||
|
||||
|
||||
describe('pattern', function() {
|
||||
|
||||
it('should validate in-lined pattern', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue