public function MultipleSelectsWidgetUiTest::testSelect2Widget in Multiple Selects 8
Test the select2 widget.
File
- tests/
src/ Functional/ MultipleSelectsWidgetUiTest.php, line 293
Class
- MultipleSelectsWidgetUiTest
- Tests the multiple select widget.
Namespace
Drupal\Tests\multiple_selects\FunctionalCode
public function testSelect2Widget() {
// Install select2.
$this->moduleInstaller
->install([
'select2',
]);
// Set select2 as the element type.
$entity_form_display = EntityFormDisplay::load('node.page.default');
$component = $entity_form_display
->getComponent('field_tags');
$component['settings']['element_type'] = 'select2';
$entity_form_display
->setComponent('field_tags', $component)
->save();
// Check that the select2 widget is used.
$this
->drupalGet('node/add/page');
$this
->assertSession()
->elementExists('css', '.select2-widget');
}