class CopyFieldValueTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/FunctionalJavascript/CopyFieldValueTest.php \Drupal\Tests\system\FunctionalJavascript\CopyFieldValueTest
Tests copy field value functionality.
@group system
Hierarchy
- class \Drupal\Tests\system\FunctionalJavascript\CopyFieldValueTest
Expanded class hierarchy of CopyFieldValueTest
See also
Drupal.behaviors.copyFieldValue.
File
-
core/
modules/ system/ tests/ src/ FunctionalJavascript/ CopyFieldValueTest.php, line 16
Namespace
Drupal\Tests\system\FunctionalJavascriptView source
class CopyFieldValueTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'starterkit_theme';
/**
* Tests copy field value JavaScript functionality.
*/
public function testCopyFieldValue() : void {
$this->drupalGet('/system-test/copy-field-value-test-form');
$page = $this->getSession()
->getPage();
$source_field_selector = 'edit-source-field';
$target_field = $page->find('css', '#edit-target-field');
$random_string = $this->randomString();
// Ensure that after source field has been filled, target field is filled
// with the same value.
$page->fillField($source_field_selector, $random_string);
$target_field->focus();
$this->assertEquals($target_field->getValue(), $random_string);
// Ensure that the target value doesn't change after it has been focused.
$page->fillField($source_field_selector, '');
$target_field->focus();
$this->assertEquals($target_field->getValue(), $random_string);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
CopyFieldValueTest::$defaultTheme | protected | property | The theme to install as the default for testing. |
CopyFieldValueTest::$modules | protected static | property | Modules to install. |
CopyFieldValueTest::testCopyFieldValue | public | function | Tests copy field value JavaScript functionality. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.