-
Notifications
You must be signed in to change notification settings - Fork 2k
Hiding the Password Strength progress when the field is empty #910
Conversation
@jloveland This is what I had originally changed to hide the indicator. However, I'd rather be checking the It was brought up to me by someone testing my app, that the wording "Password Strength" is misleading. This isn't really a standard strength indicator; it's a requirement meter. How do you feel about changing the wording? Maybe something along the lines of "Minimum Strength Requirement" ? |
@mleanos I agree. I was reviewing more docs and see that I can use $validators instead of $parse. This will leave the model in tact as the user types. I will push an update soon. Also, do you think Password Requirements above the progress bar would be clear enough instead of Password Strength? |
b981798
to
675e5bd
Compare
depending on whether we decide to change the name from Password Strength to Password Requirements, I can change the name of variables to match the language... |
@jloveland I think Password Requirements would be much more clear. As for the model, try merely changing the returned value from |
675e5bd
to
422cfa6
Compare
@mleanos I made some updates, renaming the strength meter to requirements meter. I am also hiding the requirements meter by checking the required validator only. I am convinced that moving from the $parsers pipeline to the $validators pipeline is the best choice with Angular 1.3. see this blog for reference: |
{ color: "primary", progress: "80"}, | ||
{ color: "success", progress: "100"} | ||
]; | ||
var requirementsMax = requirementsMeter.length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this being used? I don't see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! it's not used, I will remove.
@jloveland Looks great! I'm still concerned as to why the the ng-model for the password remains My preference would be to not affect the ng-model & leave it intact, but for these purposes it's probably not a huge deal. |
@ilanbiala I added you to review this one |
@lirantal are you okay with the change? If so, then @jloveland please add tests. I'd prefer from now on to prevent bugs and issues that we require tests with any PRs, because it already helps to make reviewing easier and already shows some validity of the code. |
if (origin !== viewValue) { | ||
modelCtrl.$setValidity("passwordVerify", false); | ||
return undefined; | ||
if (origin !== password) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just clean this up to be a ternary op?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
@jloveland another thing, I remember @rhutchison doing something with ng-messages. @rhutchison was that cleaner? |
I'm ok with this. |
@mleanos, |
@ilanbiala and @rhutchison I added the errors returned from password-validator within the ng-messages block. for example: |
@jloveland Thanks for the reference. I think for the purposes of this exact implementation (used for Password validation), we can go with it. However, if we implement This LGTM, and is ready to be merged from my perspective. |
} | ||
}); | ||
}; | ||
} | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jloveland Slight indentation issue.
For reference.. If the behavior of the ngModel being set to
This will allow the |
422cfa6
to
94f23f2
Compare
@ilanbiala I am trying to develop karma and e2e tests for this. I am seeing this error with protractor: |
@jloveland I think you have something set up incorrectly. In a separate commit, can you add what you have so far for tests? |
@jloveland is the testing issue fixed with the PR you have open right now? |
@ilanbiala e2e testing issues have been resolved. |
@jloveland add all the tests to this PR. |
e40241c
to
a96f094
Compare
67261c3
to
90a74fa
Compare
@@ -110,6 +110,7 @@ | |||
"karma-ng-html2js-preprocessor": "^0.1.2", | |||
"karma-phantomjs-launcher": "~0.2.0", | |||
"load-grunt-tasks": "^3.2.0", | |||
"protractor": "git://github.com/angular/protractor.git#master", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for some reason, this isn't doing the trick with node v.10 even though this PR was thought to fix the issue.
https://github.com/angular/protractor/pull/2591/files
https://travis-ci.org/angular/protractor/jobs/84351567
Anyone have thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilanbiala I am seeing that travis is failing to run using node v0.10. it looks like the error is due to node_modules/grunt-protractor-runner/node_modules/protractor/lib/configParser.js:102:29)
which seems to be an embedded protractor version..so, I suppose we need to wait until grunt-protractor-runner upgrades or we can use my fork..not sure what the best option is..
@jloveland what do you mean? |
90a74fa
to
c3386a5
Compare
@ilanbiala sorry for all the chatter here..never mind, I was looking at an old build...looks like all tests pass |
@jloveland just curious to see if any functionality wasn't covered in the tests, do you think you could try adding https://github.com/karma-runner/karma-coverage to Grunt and Gulp in a PR so we can verify? |
@ilanbiala I am also curious about that. I can add another PR for karma coverage. I was having issues writing unit tests for the directives. For the password-validator and password-verify directives, I am having trouble determining how to mock the services that the directive depends on...also, it doesn't seem to me that the directives are being loaded in the tests. I added e2e tests instead of unit tests because of the challenges I am having with figuring out how to unit test the directive that is dependent on services.. |
@jloveland let's start with a PR for karma/e2e coverage, and then we can see specifically what else needs to be tested and how to rework the tests so they are clean and intuitive. |
@jloveland Per our Gitter discussion... I verified the directives are being loaded with the tests. However, just like you, I was experiencing the
I verified that Also, to answer your question about whether or not we should put this into a separate PR. I think so. I think we should put Directive tests into their own files, since they behave differently than the other tests. For instance, we could add a new test file to modules/users/tests/client called password-validator.client.directive.tests.js Let me know what you think about this. |
Thanks to the huge help from @mleanos, I was able to add tests for the password-validator and password-verify directives. @ilanbiala I have PR #985 with karma test coverage. Does anyone out there want to take on the e2e coverage PR? |
…actoring directives to use $validators
@jloveland I was happy to help out! The tests look great. However, I did run into an issue with the E2E tests. I got the same error, as the build. All in all, this looks really good. +8.5 is nothing to sneeze at :) Great job! |
@mleanos thanks for reviewing. I am fixing the e2e test now..also rebasing.. |
a077494
to
6514044
Compare
Everything is passing now! Thanks for all the hard work you put into this @jloveland Our test coverage is getting there. Now that there's so many more E2E tests, it's entertaining to sit back & watch them run :) LGTM |
Good job guys 👍 |
I believe this is ready to merge. |
LGTM 👍 |
Hide the password strength progress when the field is empty
Renaming strength meter to requirements meter, hiding when password field is empty, and refactoring directives to use $validators, adding tests