public function BetterExposedFiltersKernelTest::testHideSubmitButtonOnAutoSubmit in Better Exposed Filters 8.4
Same name and namespace in other branches
- 8.5 tests/src/Kernel/BetterExposedFiltersKernelTest.php \Drupal\Tests\better_exposed_filters\Kernel\BetterExposedFiltersKernelTest::testHideSubmitButtonOnAutoSubmit()
Tests hiding the submit button when auto-submit is enabled.
File
- tests/
src/ Kernel/ BetterExposedFiltersKernelTest.php, line 24
Class
- BetterExposedFiltersKernelTest
- Tests the radio buttons/checkboxes filter widget (i.e. "bef").
Namespace
Drupal\Tests\better_exposed_filters\KernelCode
public function testHideSubmitButtonOnAutoSubmit() {
$view = Views::getView('bef_test');
$display =& $view->storage
->getDisplay('default');
// Enable auto-submit and hide auto-submit button.
$this
->setBetterExposedOptions($view, [
'general' => [
'autosubmit' => TRUE,
'autosubmit_hide' => TRUE,
],
]);
// Render the exposed form.
$this
->renderExposedForm($view);
// Check our "submit" button is hidden.
$actual = $this
->xpath("//form//input[@type='submit'][contains(concat(' ',normalize-space(@class),' '),' js-hide ')]");
$this
->assertCount(1, $actual, 'Submit button was hidden successfully.');
$view
->destroy();
}