public function FilterWidgetKernelTest::testCollapsibleOption in Better Exposed Filters 8.4
Same name and namespace in other branches
- 8.5 tests/src/Kernel/Plugin/filter/FilterWidgetKernelTest.php \Drupal\Tests\better_exposed_filters\Kernel\Plugin\filter\FilterWidgetKernelTest::testCollapsibleOption()
Tests moving filter option into collapsible fieldset.
File
- tests/
src/ Kernel/ Plugin/ filter/ FilterWidgetKernelTest.php, line 123
Class
- FilterWidgetKernelTest
- Tests the advanced options of a filter widget.
Namespace
Drupal\Tests\better_exposed_filters\Kernel\Plugin\filterCode
public function testCollapsibleOption() {
$view = Views::getView('bef_test');
$display =& $view->storage
->getDisplay('default');
// Enable collapsible options.
$this
->setBetterExposedOptions($view, [
'filter' => [
'field_bef_email_value' => [
'plugin_id' => 'default',
'advanced' => [
'collapsible' => TRUE,
],
],
],
]);
// Render the exposed form.
$this
->renderExposedForm($view);
// Assert our "collapsible" options detail is visible.
$actual = $this
->xpath("//form//details[@data-drupal-selector='edit-field-bef-email-value-collapsible']");
$this
->assertCount(1, $actual, '"Field BEF Email" option is displayed as collapsible fieldset.');
$view
->destroy();
}