function ConfigTranslationUiTest::testConfigTranslationDialog
Same name in other branches
- 11.x core/modules/config_translation/tests/src/FunctionalJavascript/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\FunctionalJavascript\ConfigTranslationUiTest::testConfigTranslationDialog()
Tests that the add, edit and delete operations open in a modal.
File
-
core/
modules/ config_translation/ tests/ src/ FunctionalJavascript/ ConfigTranslationUiTest.php, line 52
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\Tests\config_translation\FunctionalJavascriptCode
public function testConfigTranslationDialog() : void {
$page = $this->getSession()
->getPage();
ConfigurableLanguage::createFromLangcode('fi')->save();
$user = $this->drupalCreateUser([
'translate configuration',
]);
$this->drupalLogin($user);
$this->drupalGet('admin/structure/views/view/content/translate');
$this->clickLink('Add');
$this->assertEquals('Add Finnish translation for Content view', $this->assertSession()
->waitForElement('css', '.ui-dialog-title')
->getText());
$this->assertSession()
->fieldExists('translation[config_names][views.view.content][label]')
->setValue('Content FI');
$page->find('css', '.ui-dialog-buttonset')
->pressButton('Save translation');
$this->assertSession()
->pageTextContains('Successfully saved Finnish translation.');
$this->clickLink('Edit');
$this->assertEquals('Edit Finnish translation for Content view', $this->assertSession()
->waitForElement('css', '.ui-dialog-title')
->getText());
$this->getSession()
->getPage()
->find('css', '.ui-dialog-buttonset')
->pressButton('Save translation');
$this->assertSession()
->pageTextContains('Successfully updated Finnish translation.');
$page->find('css', '.dropbutton-toggle button')
->click();
$this->clickLink('Delete');
$this->assertEquals('Are you sure you want to delete the Finnish translation of Content view?', $this->assertSession()
->waitForElement('css', '.ui-dialog-title')
->getText());
$page->find('css', '.ui-dialog-buttonset')
->pressButton('Delete');
$this->assertSession()
->pageTextContains('Finnish translation of Content view was deleted');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.