function CKEditor5TestBase::createNewTextFormat

Same name and namespace in other branches
  1. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5TestBase::createNewTextFormat()
  2. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5TestBase::createNewTextFormat()

Create a new text format using CKEditor 5.

20 calls to CKEditor5TestBase::createNewTextFormat()
AdminUiTest::testFilterCheckboxesToggleSettings in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Test that filter settings are only visible when the filter is enabled.
AdminUiTest::testLanguageConfigForm in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Tests the language config form.
AdminUiTest::testPluginSettingsFormSection in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Tests the plugin settings form section.
AdminUiTest::testUnavailableFiltersHiddenWhenSwitching in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
CKEditor 5's filter UI modifications should not break it for other editors.
CKEditor5AllowedTagsTest::testAllowedTags in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
Test filter_html allowed tags.

... See full list

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php, line 57

Class

CKEditor5TestBase
Base class for testing CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

public function createNewTextFormat($page, $assert_session, $name = 'ckeditor5') {
    $this->drupalGet('admin/config/content/formats/add');
    $page->fillField('name', $name);
    $assert_session->waitForText('Machine name');
    $this->assertNotEmpty($assert_session->waitForText($name));
    $page->checkField('roles[authenticated]');
    if ($name === 'ckeditor5') {
        // Enable the HTML filter, at least one HTML restricting filter is needed
        // before CKEditor 5 can be enabled.
        $this->assertTrue($page->hasUncheckedField('filters[filter_html][status]'));
        $page->checkField('filters[filter_html][status]');
        $assert_session->assertWaitOnAjaxRequest();
        // Add the tags that must be included in the html filter for CKEditor 5.
        $allowed_html_field = $assert_session->fieldExists('filters[filter_html][settings][allowed_html]');
        $allowed_html_field->setValue('<p> <br>');
    }
    $page->selectFieldOption('editor[editor]', $name);
}

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