Problem/Motivation
In #3091870: Fail Functional Javascript tests that throw Javascript errors it was discovered that PasswordWidgetThemeFunctionTest created #3067523: Add Drupal JavaScript theme functions for password confirm widget has Javascript error in the test.
This doesn't currently fail the test but it should be fixed.
#3091870 can add flag to to not fail the this test with a todo to this issue
To see the error you can
- Put the line
$this->assertSession()->waitForElementVisible('css', '.test-go', 9999999999999999);at the end of\Drupal\Tests\user\FunctionalJavascript\PasswordWidgetThemeFunctionTest::setUp()This will stop the test at the end of setup
- run the test.
- When the browser pauses on the user page if you look in the js inspector console there should be an error "Uncaught TypeError: Cannot read property 'username' of undefined"
The error is
drupal.js?v=9.2.0-dev:16 Uncaught TypeError: Cannot read property 'username' of undefined
at Object.Drupal.evaluatePasswordStrength (user.js?v=9.2.0-dev:152)
at Object.attach (password-theme-functions.js?quee51:29)
at drupal.js?v=9.2.0-dev:27
at Array.forEach ()
at Object.Drupal.attachBehaviors (drupal.js?v=9.2.0-dev:24)
at drupal.init.js?v=9.2.0-dev:29
at HTMLDocument.listener (drupal.init.js?v=9.2.0-dev:17)
Proposed resolution
Fix the error
Comments
Comment #6
acbramley commentedI believe this is outdated, looking at user.js:
The only thing accessing .username in evaluatePasswordStrength is passwordSettings.username
The only thing calling evaluatePasswordStrength is passwordCheck()
The very top of that function has
Therefore, evaluatePasswordStrength wouldn't be called unless settings.password is defined.
The test mentioned in the IS also no longer exists.