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

  1. 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

  2. run the test.
  3. 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

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

tedbow created an issue. See original summary.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

acbramley’s picture

Status: Active » Closed (outdated)
Issue tags: +Bug Smash Initiative

I 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

          if (settings.password.showStrengthIndicator) {
            // Evaluate the password strength.
            const result = Drupal.evaluatePasswordStrength(
              $mainInput[0].value,
              settings.password,
            );

Therefore, evaluatePasswordStrength wouldn't be called unless settings.password is defined.

The test mentioned in the IS also no longer exists.