mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-12 22:35:30 +08:00
fix(input): by default, do not trim input[type=password] values
Do not trim input[type=password] values BREAKING CHANGE: Previously, input[type=password] would trim values by default, and would require an explicit ng-trim="false" to disable the trimming behaviour. After this CL, ng-trim no longer effects input[type=password], and will never trim the password value. Closes #8250 Closes #8230 Conflicts: src/ng/directive/input.js
This commit is contained in:
@@ -1546,6 +1546,30 @@ describe('input', function() {
|
||||
expect(scope.items[0].selected).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('password', function() {
|
||||
// Under no circumstances should input[type=password] trim inputs
|
||||
it('should not trim if ngTrim is unspecified', function() {
|
||||
compileInput('<input type="password" ng-model="password">');
|
||||
changeInputValueTo(' - - untrimmed - - ');
|
||||
expect(scope.password.length).toBe(' - - untrimmed - - '.length);
|
||||
});
|
||||
|
||||
|
||||
it('should not trim if ngTrim !== false', function() {
|
||||
compileInput('<input type="password" ng-model="password" ng-trim="true">');
|
||||
changeInputValueTo(' - - untrimmed - - ');
|
||||
expect(scope.password.length).toBe(' - - untrimmed - - '.length);
|
||||
});
|
||||
|
||||
|
||||
it('should not trim if ngTrim === false', function() {
|
||||
compileInput('<input type="password" ng-model="password" ng-trim="false">');
|
||||
changeInputValueTo(' - - untrimmed - - ');
|
||||
expect(scope.password.length).toBe(' - - untrimmed - - '.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('NgModel animations', function() {
|
||||
|
||||
Reference in New Issue
Block a user