function OptionsFieldUIAllowedValuesTest::assertHasFocusByAttribute

Same name in other branches
  1. 11.x core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php \Drupal\Tests\options\FunctionalJavascript\OptionsFieldUIAllowedValuesTest::assertHasFocusByAttribute()

Asserts an element specified by an attribute value has focus.

@todo Replace with assertHasFocus() in https://drupal.org/i/3041768.

Parameters

string $name: The attribute name.

string $value: The attribute value.

1 call to OptionsFieldUIAllowedValuesTest::assertHasFocusByAttribute()
OptionsFieldUIAllowedValuesTest::testOptionsAllowedValues in core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php
Tests option types allowed values.

File

core/modules/options/tests/src/FunctionalJavascript/OptionsFieldUIAllowedValuesTest.php, line 373

Class

OptionsFieldUIAllowedValuesTest
Tests the Options field allowed values UI functionality.

Namespace

Drupal\Tests\options\FunctionalJavascript

Code

private function assertHasFocusByAttribute(string $name, string $value) : void {
    $active_element = $this->getSession()
        ->evaluateScript('document.activeElement');
    $this->assertSame($value, $active_element->attribute($name));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.