You are here

public function LingotekSupportedLocalesControllerTest::testFilterSupportedLocales in Lingotek Translation 3.8.x

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  2. 4.0.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  3. 3.0.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  4. 3.1.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  5. 3.2.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  6. 3.3.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  7. 3.4.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  8. 3.5.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  9. 3.6.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()
  10. 3.7.x tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekSupportedLocalesControllerTest::testFilterSupportedLocales()

Tests that the supported locales are rendered.

File

tests/src/FunctionalJavascript/LingotekSupportedLocalesControllerTest.php, line 13

Class

LingotekSupportedLocalesControllerTest
@group lingotek

Namespace

Drupal\Tests\lingotek\FunctionalJavascript

Code

public function testFilterSupportedLocales() {
  $this
    ->drupalGet('/admin/lingotek/supported-locales');
  $assert = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();

  // There are three languages.
  $assert
    ->elementsCount('css', 'table.locales-listing-table tbody tr', 3);

  // And the text filter is empty.
  $field_locator = 'input.locales-filter-text';
  $filter_field = $assert
    ->waitForElementVisible('css', $field_locator);
  $filter_field
    ->focus();
  $search = $filter_field
    ->getValue();
  $this
    ->assertEmpty($search);

  // Filter German languages.
  $assert
    ->waitForElementVisible('css', $field_locator)
    ->setValue('German');
  $trs = $page
    ->findAll('css', 'table.locales-listing-table tbody tr');
  $this
    ->assertCount(3, $trs);

  // There are two German languages.
  $trs = $this
    ->filterVisibleElements($trs);
  $this
    ->assertCount(2, $trs);

  // Filter Austrian languages.
  $assert
    ->waitForElementVisible('css', $field_locator)
    ->setValue('Austria');
  $trs = $page
    ->findAll('css', 'table.locales-listing-table tbody tr');
  $this
    ->assertCount(3, $trs);

  // There is only one language from Austria.
  $trs = $this
    ->filterVisibleElements($trs);
  $this
    ->assertCount(1, $trs);
}