function CKEditorIntegrationTest::testDrupalImageDialog

Same name in other branches
  1. 9 core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest::testDrupalImageDialog()

Tests if the Image button appears and works as expected.

File

core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php, line 140

Class

CKEditorIntegrationTest
Tests the integration of CKEditor.

Namespace

Drupal\Tests\ckeditor\FunctionalJavascript

Code

public function testDrupalImageDialog() {
    $session = $this->getSession();
    $web_assert = $this->assertSession();
    $this->drupalGet('node/add/page');
    $session->getPage();
    // Asserts the Image button is present in the toolbar.
    $web_assert->elementExists('css', '#cke_edit-body-0-value .cke_button__drupalimage');
    // Asserts the image dialog opens when clicking the Image button.
    $this->click('.cke_button__drupalimage');
    $this->assertNotEmpty($web_assert->waitForElement('css', '.ui-dialog'));
    $web_assert->elementContains('css', '.ui-dialog .ui-dialog-titlebar', 'Insert Image');
}

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