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:
Caitlin Potter
2014-07-17 21:44:48 -04:00
parent 4b7398eeca
commit ebece0bcb9
2 changed files with 37 additions and 3 deletions

View File

@@ -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() {