function CKEditor5TestBase::addNewTextFormat

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

Add and save a new text format using CKEditor 5.

10 calls to CKEditor5TestBase::addNewTextFormat()
AdminUiTest::testImageUploadSettingsAreValidated in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Tests that image upload settings (stored out of band) are validated too.
AdminUiTest::testMessagesDoNotAccumulate in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Ensure CKEditor 5 admin UI's real-time validation errors do not accumulate.
AdminUiTest::testSettingsOnlyFireAjaxWithCkeditor5 in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Confirm settings only trigger AJAX when select value is CKEditor 5.
CKEditor5MarkupTest::testFilterHtmlAllowedGlobalAttributes in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5MarkupTest.php
Ensures that CKEditor 5 retains filter_html's allowed global attributes.
CKEditor5OffCanvasTest::testOffCanvasStyles in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5OffCanvasTest.php
Tests if CKEditor is properly styled inside an off-canvas dialog.

... See full list

File

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

Class

CKEditor5TestBase
Base class for testing CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

protected function addNewTextFormat($name = 'ckeditor5') : void {
    FilterFormat::create([
        'format' => $name,
        'roles' => [
            RoleInterface::AUTHENTICATED_ID,
        ],
        'name' => $name,
        'filters' => [
            'filter_html' => [
                'status' => TRUE,
                'settings' => [
                    'allowed_html' => '<br> <p> <h2> <h3> <h4> <h5> <h6> <strong> <em>',
                ],
            ],
            'filter_align' => [
                'status' => TRUE,
            ],
            'filter_caption' => [
                'status' => TRUE,
            ],
        ],
    ])->save();
    Editor::create([
        'editor' => $name,
        'format' => $name,
        'image_upload' => [
            'status' => FALSE,
        ],
    ])->save();
}

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