You are here

public function CKEditorToolbarButtonTest::testImageButtonDisplay in Zircon Profile 8

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

Method tests CKEditor image buttons.

File

core/modules/ckeditor/src/Tests/CKEditorToolbarButtonTest.php, line 59
Contains \Drupal\ckeditor\Tests\CKEditorToolbarButtonTest.

Class

CKEditorToolbarButtonTest
Tests CKEditor toolbar buttons when the language direction is RTL.

Namespace

Drupal\ckeditor\Tests

Code

public function testImageButtonDisplay() {
  global $base_url;
  $this
    ->drupalLogin($this->admin_user);

  // Install the Arabic language (which is RTL) and configure as the default.
  $edit = [];
  $edit['predefined_langcode'] = 'ar';
  $this
    ->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
  $edit = [
    'site_default_language' => 'ar',
  ];
  $this
    ->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration'));

  // Once the default language is changed, go to the tested text format
  // configuration page.
  $this
    ->drupalGet('admin/config/content/formats/manage/full_html');

  // Check if any image button is loaded in CKEditor json.
  $json_encode = function ($html) {
    return trim(Json::encode($html), '"');
  };
  $markup = $json_encode($base_url . '/core/modules/ckeditor/js/plugins/drupalimage/image.png');
  $this
    ->assertRaw($markup);
}