public function DisplayTest::testAddDisplayBlockTranslation in Drupal 10
Test if 'add' translations are filtered from multilingual display options.
File
- core/
modules/ views_ui/ tests/ src/ FunctionalJavascript/ DisplayTest.php, line 161
Class
- DisplayTest
- Tests the display UI.
Namespace
Drupal\Tests\views_ui\FunctionalJavascriptCode
public function testAddDisplayBlockTranslation() {
// Set up an additional language (Hungarian).
$langcode = 'hu';
ConfigurableLanguage::createFromLangcode($langcode)
->save();
$config = $this
->config('language.negotiation');
$config
->set('url.prefixes', [
$langcode => $langcode,
])
->save();
\Drupal::service('kernel')
->rebuildContainer();
\Drupal::languageManager()
->reset();
// Add Hungarian translations.
$this
->addTranslation($langcode, 'Block', 'Blokk');
$this
->addTranslation($langcode, 'Add @display', '@display hozzáadása');
$this
->drupalGet('hu/admin/structure/views/view/test_display');
$page = $this
->getSession()
->getPage();
$page
->find('css', '#views-display-menu-tabs .add')
->click();
// Wait for the animation to complete.
$this
->assertSession()
->assertWaitOnAjaxRequest();
// Look for the input element, always in second spot.
$elements = $page
->findAll('css', '.add ul input');
$this
->assertEquals('Blokk', $elements[1]
->getAttribute('value'));
}