function CKEditor5UpdateAlignmentTest::testUpdateAlignmentButtons

Tests update of individual button that are alignment configuration.

File

core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdateAlignmentTest.php, line 36

Class

CKEditor5UpdateAlignmentTest
Tests the update path for CKEditor 5 alignment.

Namespace

Drupal\Tests\ckeditor5\Functional\Update

Code

public function testUpdateAlignmentButtons() {
  $editor = Editor::load('test_format');
  $settings = $editor->getSettings();
  $this->assertContains('alignment:center', $settings['toolbar']['items']);
  $this->runUpdates();
  $expected_toolbar_items = [
    'link',
    'bold',
    'italic',
    'sourceEditing',
    'alignment',
  ];
  $expected_alignment_plugin = [
    'enabled_alignments' => [
      'center',
    ],
  ];
  $editor = Editor::load('test_format');
  $settings = $editor->getSettings();
  $this->assertEquals($expected_toolbar_items, $settings['toolbar']['items']);
  $this->assertEquals($expected_alignment_plugin, $settings['plugins']['ckeditor5_alignment']);
}

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