public function LanguageSwitcherExtendedTest::testShowCurrentLanguageWithoutLink in Language Switcher Extended 8
Tests that current language without link is working.
File
- tests/
src/ Functional/ LanguageSwitcherExtendedTest.php, line 280
Class
- LanguageSwitcherExtendedTest
- Functional tests for the language_switcher_extended feature.
Namespace
Drupal\Tests\language_switcher_extended\FunctionalCode
public function testShowCurrentLanguageWithoutLink() {
// Open the module's configuration page.
$this
->drupalGet('admin/config/regional/language/language-switcher-extended');
// Configure to show untranslated translations without a link.
$edit = [
'mode' => 'always_link_to_front',
'current_language_mode' => 'no_link',
];
$this
->submitForm($edit, 'Save configuration');
// Open the node without a translation.
$this
->drupalGet('en/node/1');
// Verify that the current language is not linked.
$this
->assertSession()
->elementExists('css', '#block-test-language-block li.en .is-active');
$this
->assertSession()
->elementNotExists('css', '#block-test-language-block li.en a');
// Verify that other language links lead to the homepage.
$this
->assertSession()
->elementAttributeContains('css', '#block-test-language-block li[hreflang="de"] a', 'data-drupal-link-system-path', '<front>');
}