function EmphasisTest::testEmphasis

Same name in other branches
  1. 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/EmphasisTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\EmphasisTest::testEmphasis()
  2. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/EmphasisTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\EmphasisTest::testEmphasis()

Ensures that CKEditor italic model is converted to em.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/EmphasisTest.php, line 123

Class

EmphasisTest
Tests emphasis in CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function testEmphasis() : void {
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    $this->drupalGet($this->host
        ->toUrl('edit-form'));
    $this->waitForEditor();
    $emphasis_element = $assert_session->waitForElementVisible('css', '.ck-content p em');
    $this->assertEquals('test!', $emphasis_element->getText());
    $xpath = new \DOMXPath($this->getEditorDataAsDom());
    $emphasis_source = $xpath->query('//p/em');
    $this->assertNotEmpty($emphasis_source);
    $this->assertEquals('test!', $emphasis_source[0]->textContent);
    $page->pressButton('Save');
    $assert_session->responseContains('<p>This is a <em>test!</em></p>');
}

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