You are here

public function WidgetIntegrationTest::testDropdownWidget in Facets 8

Tests dropdown widget's basic functionality.

File

tests/src/Functional/WidgetIntegrationTest.php, line 73

Class

WidgetIntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

public function testDropdownWidget() {
  $id = 'select_widget';
  $this
    ->createFacet('Select', $id);
  $this
    ->drupalGet('admin/config/search/facets/' . $id . '/edit');
  $this
    ->drupalPostForm(NULL, [
    'widget' => 'dropdown',
  ], 'Configure widget');
  $this
    ->drupalPostForm(NULL, [
    'widget' => 'dropdown',
    'facet_settings[show_only_one_result]' => TRUE,
  ], 'Save');
  $this
    ->drupalGet('search-api-test-fulltext');
  $this
    ->assertSession()
    ->pageTextContains('Displaying 5 search results');
  $this
    ->assertFacetLabel('item');
  $this
    ->assertFacetLabel('article');
}