protected function InlineBlockTranslationTest::updateTranslatedBlock in Layout Builder Symmetric Translations 8
Update a translation inline block.
Parameters
string $existing_label: The inline block's existing label.
string $existing_body: The inline block's existing body field value.
string $new_label: The new label.
string $new_body: The new body field value.
1 call to InlineBlockTranslationTest::updateTranslatedBlock()
- InlineBlockTranslationTest::testInlineBlockContentTranslation in tests/
src/ FunctionalJavascript/ InlineBlockTranslationTest.php - Tests that inline blocks works with content translation.
File
- tests/
src/ FunctionalJavascript/ InlineBlockTranslationTest.php, line 222
Class
- InlineBlockTranslationTest
- Tests that inline blocks works with content translation.
Namespace
Drupal\Tests\layout_builder_st\FunctionalJavascriptCode
protected function updateTranslatedBlock($existing_label, $existing_body, $new_label, $new_body) {
$assert_session = $this
->assertSession();
$page = $this
->getSession()
->getPage();
$this
->clickContextualLink(static::INLINE_BLOCK_LOCATOR, 'Translate block');
$textarea = $assert_session
->waitForElement('css', '[name="body[0][value]"]');
$this
->assertNotEmpty($textarea);
$this
->assertEquals($existing_body, $textarea
->getValue());
$textarea
->setValue($new_body);
$label_input = $assert_session
->elementExists('css', '#drupal-off-canvas [name="info[0][value]"]');
$this
->assertNotEmpty($label_input);
$this
->assertEquals($existing_label, $label_input
->getValue());
$label_input
->setValue($new_label);
$page
->pressButton('Save');
$this
->assertNoElementAfterWait('#drupal-off-canvas');
$assert_session
->assertWaitOnAjaxRequest();
$assert_session
->pageTextContains($new_label);
$assert_session
->pageTextContains($new_body);
$assert_session
->pageTextNotContains($existing_label);
$assert_session
->pageTextNotContains($existing_body);
}