You are here

protected function TestHelperTrait::clickPartialLink in Facets 8

Click a link by partial name.

Parameters

string $label: The label of a link to click.

3 calls to TestHelperTrait::clickPartialLink()
IntegrationTest::testFacetCountCalculations in tests/src/Functional/IntegrationTest.php
Tests calculations of facet count.
IntegrationTest::testMultipleFacets in tests/src/Functional/IntegrationTest.php
Tests behavior with multiple enabled facets and their interaction.
WidgetIntegrationTest::testLinksShowHideCount in tests/src/Functional/WidgetIntegrationTest.php
Tests the functionality of a widget to hide/show the item-count.

File

tests/src/Functional/TestHelperTrait.php, line 135

Class

TestHelperTrait
Adds helpers for test methods.

Namespace

Drupal\Tests\facets\Functional

Code

protected function clickPartialLink($label) {
  $label = (string) $label;
  $xpath = $this
    ->assertSession()
    ->buildXPathQuery('//a[starts-with(normalize-space(), :label)]', [
    ':label' => $label,
  ]);
  $links = $this
    ->getSession()
    ->getPage()
    ->findAll('xpath', $xpath);
  $links[0]
    ->click();
}