public function ParagraphSplitTest::testAddParagraphAfterSplitDataLoss in Thunder 6.2.x
Same name and namespace in other branches
- 8.5 tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testAddParagraphAfterSplitDataLoss()
- 8.2 tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testAddParagraphAfterSplitDataLoss()
- 8.3 tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testAddParagraphAfterSplitDataLoss()
- 8.4 tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testAddParagraphAfterSplitDataLoss()
- 6.0.x tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testAddParagraphAfterSplitDataLoss()
- 6.1.x tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testAddParagraphAfterSplitDataLoss()
Test if a adding paragraph after split leads to data loss.
File
- tests/
src/ FunctionalJavascript/ Integration/ ParagraphSplitTest.php, line 95
Class
- ParagraphSplitTest
- Tests the paragraph split module integration.
Namespace
Drupal\Tests\thunder\FunctionalJavascript\IntegrationCode
public function testAddParagraphAfterSplitDataLoss() {
$firstParagraphContent = '<p>Content that will be in the first paragraph after the split.</p>';
$secondParagraphContent = '<p>Content that will be in the second paragraph after the split.</p>';
$thirdParagraphContent = '<p>Content that will be placed into the first paragraph after split.</p>';
$this
->articleFillNew([]);
// Create first paragraph.
$this
->addTextParagraph(static::$paragraphsField, $firstParagraphContent . $secondParagraphContent);
// Select second element in editor.
$this
->selectCkEditorElement($this
->getCkEditorCssSelector(0), 1);
// Split text paragraph.
$this
->clickParagraphSplitButton();
$this
->assertWaitOnAjaxRequest();
$paragraphDelta = $this
->getParagraphDelta(static::$paragraphsField, 0);
$ckEditorCssSelector = "textarea[name='" . static::$paragraphsField . "[{$paragraphDelta}][subform][field_text][0][value]']";
$this
->fillCkEditor($ckEditorCssSelector, $thirdParagraphContent);
$ckEditorId = $this
->getCkEditorId($ckEditorCssSelector);
$this
->getSession()
->getDriver()
->executeScript("window.ed = CKEDITOR.instances[\"{$ckEditorId}\"]; window.ed.setData(\"{$thirdParagraphContent}\"); window.ed.updateElement(); window.ed.element.data('editor-value-is-changed', true);");
$this
->addTextParagraph(static::$paragraphsField, '', 'text', 1);
// Test if all texts are in the correct paragraph.
$this
->assertCkEditorContent($this
->getCkEditorCssSelector(0), $thirdParagraphContent . PHP_EOL);
$this
->assertCkEditorContent($this
->getCkEditorCssSelector(2), '');
$this
->assertCkEditorContent($this
->getCkEditorCssSelector(1), $secondParagraphContent . PHP_EOL);
}