function PasswordConfirmWidgetTest::testPasswordConfirmMessage
Same name in other branches
- 9 core/modules/user/tests/src/FunctionalJavascript/PasswordConfirmWidgetTest.php \Drupal\Tests\user\FunctionalJavascript\PasswordConfirmWidgetTest::testPasswordConfirmMessage()
- 11.x core/modules/user/tests/src/FunctionalJavascript/PasswordConfirmWidgetTest.php \Drupal\Tests\user\FunctionalJavascript\PasswordConfirmWidgetTest::testPasswordConfirmMessage()
Ensures that password match message is visible when widget is initialized.
1 method overrides PasswordConfirmWidgetTest::testPasswordConfirmMessage()
- ClaroPasswordConfirmWidgetTest::testPasswordConfirmMessage in core/
tests/ Drupal/ FunctionalJavascriptTests/ Theme/ ClaroPasswordConfirmWidgetTest.php - Tests that password match message is invisible when widget is initialized.
File
-
core/
modules/ user/ tests/ src/ FunctionalJavascript/ PasswordConfirmWidgetTest.php, line 132
Class
- PasswordConfirmWidgetTest
- Tests the JS components added to the PasswordConfirm render element.
Namespace
Drupal\Tests\user\FunctionalJavascriptCode
public function testPasswordConfirmMessage() : void {
$this->drupalGet($this->testUser
->toUrl('edit-form'));
$password_confirm_widget_selector = '.js-form-type-password-confirm.js-form-item-pass';
$password_confirm_selector = '.js-form-item-pass-pass2';
$password_confirm_widget = $this->assert
->elementExists('css', $password_confirm_widget_selector);
$password_confirm_item = $password_confirm_widget->find('css', $password_confirm_selector);
// Password match message.
$this->assertTrue($password_confirm_item->has('css', 'input.js-password-confirm + [data-drupal-selector="password-confirm-message"]'));
$this->assertTrue($password_confirm_item->find('css', 'input.js-password-confirm + [data-drupal-selector="password-confirm-message"]')
->isVisible());
$this->assert
->elementContains('css', "{$password_confirm_widget_selector} {$password_confirm_selector}", '<div aria-live="polite" aria-atomic="true" class="password-confirm-message" data-drupal-selector="password-confirm-message">Passwords match: <span data-drupal-selector="password-match-status-text"></span></div>');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.