You are here

public function AjaxBehaviorTest::testLinksWithExposedFilter in Facets 8

Tests links with exposed filters.

File

tests/src/FunctionalJavascript/AjaxBehaviorTest.php, line 183

Class

AjaxBehaviorTest
Tests for the JS that powers ajax.

Namespace

Drupal\Tests\facets\FunctionalJavascript

Code

public function testLinksWithExposedFilter() {
  $view = View::load('search_api_test_view');
  $display = $view
    ->getDisplay('page_1');
  $display['display_options']['filters']['search_api_fulltext']['expose']['required'] = TRUE;
  $view
    ->save();
  $this
    ->createFacet('owl');
  $this
    ->drupalGet('search-api-test-fulltext');
  $page = $this
    ->getSession()
    ->getPage();
  $block_owl = $page
    ->findById('block-owl-block');
  $block_owl
    ->isVisible();
  $this
    ->assertSession()
    ->fieldExists('edit-search-api-fulltext')
    ->setValue('baz');
  $this
    ->click('.form-submit');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->assertSession()
    ->pageTextContains('Displaying 3 search results');
  $this
    ->clickLink('item');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->assertSession()
    ->pageTextContains('Displaying 1 search results');
}