You are here

public function Select2Test::testSelect2Theming in Select 2 8

@covers ::preRenderSelect @covers ::preRenderAutocomplete

File

tests/src/Kernel/Element/Select2Test.php, line 23

Class

Select2Test
@coversDefaultClass \Drupal\select2\Element\Select2

Namespace

Drupal\Tests\select2\Kernel\Element

Code

public function testSelect2Theming() {
  $select = [
    '#type' => 'select2',
    '#options' => [],
    '#required' => FALSE,
    '#attributes' => [
      'data-drupal-selector' => 'field-foo',
    ],
  ];
  $this
    ->render($select);
  $select2_js = $this
    ->xpath("//script[contains(@src, 'select2/js/select2.js')]");
  $this
    ->assertEquals(1, count($select2_js));
  $select2_js = $this
    ->xpath("//script[contains(@src, 'select2/dist/js/select2.min.js')]");
  $this
    ->assertEquals(1, count($select2_js));
}