You are here

protected function TestBase::assertVariableOptions in Twig Field 8

Assets Twig variable options.

1 call to TestBase::assertVariableOptions()
TwigFieldTest::testTwigField in tests/src/FunctionalJavascript/TwigFieldTest.php
Test callback.

File

tests/src/FunctionalJavascript/TestBase.php, line 114

Class

TestBase
Base class for Twig field tests.

Namespace

Drupal\Tests\twig_field\FunctionalJavascript

Code

protected function assertVariableOptions(array $options) {
  $assert_session = $this
    ->assertSession();
  $prefix = '//select[@name = "field_template[0][footer][variables]"]';
  foreach ($options as $label => $group_options) {
    foreach ($group_options as $option) {
      $xpath = sprintf('%s/optgroup[@label = "%s"]/option[@value = "%s"]', $prefix, $label, $option);
      $assert_session
        ->elementExists('xpath', $xpath);
    }
  }
}