You are here

public function ThunderJavascriptTestBase::setRawFieldValue in Thunder 6.0.x

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::setRawFieldValue()
  2. 8.2 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::setRawFieldValue()
  3. 8.3 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::setRawFieldValue()
  4. 8.4 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::setRawFieldValue()
  5. 6.2.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::setRawFieldValue()
  6. 6.1.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::setRawFieldValue()

Set value directly to field value, without formatting applied.

Parameters

string $fieldName: Field name.

string $rawValue: Raw value for field.

1 call to ThunderJavascriptTestBase::setRawFieldValue()
MediaImageModifyTest::testImageEdit in tests/src/FunctionalJavascript/MediaImageModifyTest.php
Test Image modifications (edit fields).

File

tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php, line 340

Class

ThunderJavascriptTestBase
Base class for Thunder Javascript functional tests.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function setRawFieldValue($fieldName, $rawValue) {

  // Set date over jQuery, because browser drivers handle input value
  // differently. fe. (Firefox will set it as "value" for field, but Chrome
  // will use it as text for that input field, and in that case final value
  // depends on format used for input field. That's why it's better to set it
  // directly to value, independently from format used.
  $this
    ->getSession()
    ->executeScript("jQuery('[name=\"{$fieldName}\"]').val('{$rawValue}')");
}