public function WidgetIntegrationTest::testAllLink in Facets 8
Tests the all link.
File
- tests/
src/ Functional/ WidgetIntegrationTest.php, line 179
Class
- WidgetIntegrationTest
- Tests the overall functionality of the Facets admin UI.
Namespace
Drupal\Tests\facets\FunctionalCode
public function testAllLink() {
$id = 'kepler_16b';
$this
->createFacet('Kepler 16b', $id);
$editUrl = 'admin/config/search/facets/' . $id . '/edit';
$this
->drupalPostForm($editUrl, [
'widget' => 'links',
], 'Save');
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetLabel('item');
$this
->assertFacetLabel('article');
$this
->clickLink('item');
$this
->checkFacetIsActive('item');
// Enable the all (reset) link.
$this
->drupalPostForm($editUrl, [
'widget_config[show_reset_link]' => TRUE,
], 'Save');
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetLabel('item');
$this
->assertFacetLabel('article');
$this
->findFacetLink('Show all');
// Change the text.
$edit = [
'widget_config[show_reset_link]' => TRUE,
'widget_config[reset_text]' => 'Planets',
];
$this
->drupalPostForm($editUrl, $edit, 'Save');
// Check that the new text appears and no facets are active.
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetLabel('item');
$this
->assertFacetLabel('article');
$this
->findFacetLink('Planets (5)');
$this
->checkFacetIsNotActive('item');
$this
->checkFacetIsNotActive('article');
// Click one of the facets.
$this
->clickLink('item');
$this
->checkFacetIsActive('item');
// Click the rest link.
$this
->clickLink('Planets');
$this
->checkFacetIsNotActive('item');
$this
->checkFacetIsNotActive('article');
}