You are here

public function MultiselectElementJavascriptTest::testDefaultValue in Multiselect 8

Same name and namespace in other branches
  1. 2.x tests/src/FunctionalJavascript/MultiselectElementJavascriptTest.php \Drupal\Tests\multiselect\FunctionalJavascript\MultiselectElementJavascriptTest::testDefaultValue()

Tests the default values of multiselect elements.

File

tests/src/FunctionalJavascript/MultiselectElementJavascriptTest.php, line 87

Class

MultiselectElementJavascriptTest
Tests the multiselect element using JavaScript.

Namespace

Drupal\Tests\multiselect\FunctionalJavascript

Code

public function testDefaultValue() {
  $this
    ->drupalGet('/multiselect_test/page');
  $options = [];
  $this
    ->assertOptions('.js-form-item-no-default #edit-no-default', $options);
  $options['banana'] = 'Banana';
  $this
    ->assertOptions('.js-form-item-single-default #edit-single-default', $options);
  $options['cherry'] = 'Cherry';
  $this
    ->assertOptions('.js-form-item-multiple-default #edit-multiple-default', $options);
}