function DisplayTest::testAddDisplayBlockTranslation

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php \Drupal\Tests\views_ui\FunctionalJavascript\DisplayTest::testAddDisplayBlockTranslation()
  2. 11.x core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php \Drupal\Tests\views_ui\FunctionalJavascript\DisplayTest::testAddDisplayBlockTranslation()

Test if 'add' translations are filtered from multilingual display options.

File

core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php, line 163

Class

DisplayTest
Tests the display UI.

Namespace

Drupal\Tests\views_ui\FunctionalJavascript

Code

public function testAddDisplayBlockTranslation() : void {
    // 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->getSession()
        ->wait(1000, "jQuery(':animated').length === 0;");
    // Look for the input element, always in second spot.
    $elements = $page->findAll('css', '.add ul input');
    $this->assertEquals('Blokk', $elements[1]->getAttribute('value'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.