You are here

function CKEditorTest::testBuildContentsCssJSSetting in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/ckeditor/src/Tests/CKEditorTest.php \Drupal\ckeditor\Tests\CKEditorTest::testBuildContentsCssJSSetting()

Tests CKEditor::buildContentsCssJSSetting().

File

core/modules/ckeditor/src/Tests/CKEditorTest.php, line 255
Contains \Drupal\ckeditor\Tests\CKEditorTest.

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\ckeditor\Tests

Code

function testBuildContentsCssJSSetting() {
  $editor = entity_load('editor', 'filtered_html');

  // Default toolbar.
  $expected = $this
    ->getDefaultContentsCssConfig();
  $this
    ->assertIdentical($expected, $this->ckeditor
    ->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly for default toolbar.');

  // Enable the editor_test module, which implements hook_ckeditor_css_alter().
  $this
    ->enableModules(array(
    'ckeditor_test',
  ));
  $expected[] = file_create_url('core/modules/ckeditor/tests/modules/ckeditor_test.css');
  $this
    ->assertIdentical($expected, $this->ckeditor
    ->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a hook_ckeditor_css_alter() implementation exists.');

  // Enable the Bartik theme, which specifies a CKEditor stylesheet.
  \Drupal::service('theme_handler')
    ->install([
    'bartik',
  ]);
  $this
    ->config('system.theme')
    ->set('default', 'bartik')
    ->save();
  $expected[] = file_create_url('core/themes/bartik/css/base/elements.css');
  $expected[] = file_create_url('core/themes/bartik/css/components/captions.css');
  $expected[] = file_create_url('core/themes/bartik/css/components/table.css');
  $this
    ->assertIdentical($expected, $this->ckeditor
    ->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a theme providing a CKEditor stylesheet exists.');
}