You are here

public function ParagraphSplitTest::testParagraphSplitBefore in Thunder 8.5

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testParagraphSplitBefore()
  2. 8.3 tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testParagraphSplitBefore()
  3. 8.4 tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testParagraphSplitBefore()
  4. 6.2.x tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testParagraphSplitBefore()
  5. 6.0.x tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testParagraphSplitBefore()
  6. 6.1.x tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php \Drupal\Tests\thunder\FunctionalJavascript\Integration\ParagraphSplitTest::testParagraphSplitBefore()

Test split of paragraph before a selection.

File

tests/src/FunctionalJavascript/Integration/ParagraphSplitTest.php, line 39

Class

ParagraphSplitTest
Tests the paragraph split module integration.

Namespace

Drupal\Tests\thunder\FunctionalJavascript\Integration

Code

public function testParagraphSplitBefore() {
  $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>';
  $this
    ->articleFillNew([]);

  // Add text paragraph with two elements.
  $this
    ->addTextParagraph(static::$paragraphsField, $firstParagraphContent . $secondParagraphContent);

  // Select second element in editor.
  $this
    ->selectCkEditorElement($this
    ->getCkEditorCssSelector(0), 1);

  // Split text paragraph before the current selection.
  $this
    ->clickParagraphSplitButton();
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();

  // Test if all texts are in the correct paragraph.
  $this
    ->assertCkEditorContent($this
    ->getCkEditorCssSelector(0), $firstParagraphContent . PHP_EOL);
  $this
    ->assertCkEditorContent($this
    ->getCkEditorCssSelector(1), $secondParagraphContent . PHP_EOL);
}