You are here

public function ViewsExposedGroupsInheritedPropertiesTest::testView in Views exposed groups 3.0.x

Asserts that the view itself is displayed correctly.

It is not possible to test the actual functionality of the reset and autosubmit functionality.

File

tests/src/Functional/ViewsExposedGroupsInheritedPropertiesTest.php, line 78

Class

ViewsExposedGroupsInheritedPropertiesTest
Tests a view with exposed groups and autosubmit.

Namespace

Drupal\Tests\views_exposed_groups\Functional

Code

public function testView() {
  $view_path = $this->defaultView
    ->getDisplay('page_1')
    ->getOption('path');

  // Bypass the UI for this test.
  $this->defaultView
    ->getDisplay('default')
    ->setOption('exposed_form.options.autosubmit', TRUE)
    ->setOption('exposed_form.options.autosubmit_hide', TRUE)
    ->setOption('exposed_form.options.reset_button', TRUE);
  $this->defaultView
    ->save();
  $this
    ->drupalLogin($this->unprivilegedUser);
  $this
    ->drupalGet($view_path);

  // An apply button exists when Javascript is disabled so assert that this
  // exists for autosubmit.
  $this
    ->assertFieldByXpath('//input[@value="Apply" and @type="submit" and contains(@class, "js-hide")]');

  // Asserts that the reset button exists.
  $this
    ->assertFieldByXpath('//input[@value="Reset" and @type="submit"]');
}