You are here

public function BetterExposedFiltersKernelTest::testHideSubmitButtonOnAutoSubmit in Better Exposed Filters 8.5

Same name and namespace in other branches
  1. 8.4 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\Kernel

Code

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();
}