Merge pull request #662 from yemel/fix/password-strength-hint

Change wording of very weak password, add strength tip, add tests
This commit is contained in:
Ryan X. Charles 2014-06-12 09:45:50 -07:00
commit b1eb0bffbc
3 changed files with 53 additions and 37 deletions

View file

@ -63,4 +63,39 @@ describe("Unit: Testing Directives", function() {
});
});
describe('Password strength', function() {
beforeEach(inject(function($compile, $rootScope) {
$scope = $rootScope;
var element = angular.element(
'<input type="password" name="password" ng-model="password" check-strength="passwordStrength" value="asd" required>'
);
$compile(element)($scope);
$scope.$digest();
}));
it('should check very weak password', function() {
$scope.password = 'asd';
$scope.$digest();
expect($scope.passwordStrength).to.equal('very weak');
});
it('should check weak password', function() {
$scope.password = 'asdasdASDASD';
$scope.$digest();
expect($scope.passwordStrength).to.equal('weak');
});
it('should check medium password', function() {
$scope.password = 'asdasdASDASD1';
$scope.$digest();
expect($scope.passwordStrength).to.equal('medium');
});
it('should check strong password', function() {
$scope.password = 'asdasdASDASD1{';
$scope.$digest();
expect($scope.passwordStrength).to.equal('strong');
});
});
});