You are here

protected function FormatterTest::updateFormatterSettingField in The CodeMirror Editor 8

Sets a value for a given settings field.

1 call to FormatterTest::updateFormatterSettingField()
FormatterTest::testFormatter in tests/src/FunctionalJavascript/FormatterTest.php
Test callback.

File

tests/src/FunctionalJavascript/FormatterTest.php, line 148

Class

FormatterTest
Tests the CodeMirror field formatter.

Namespace

Drupal\Tests\codemirror_editor\FunctionalJavascript

Code

protected function updateFormatterSettingField($name, $value) {
  $page = $this
    ->getSession()
    ->getPage();
  $field_name = "fields[field_code][settings_edit_form][settings][{$name}]";
  if (is_bool($value)) {
    $value ? $page
      ->checkField($field_name) : $page
      ->uncheckField($field_name);
  }
  else {
    $page
      ->selectFieldOption($field_name, $value);
  }
}