Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @file
* Contains \Drupal\ckeditor\Tests\CKEditorToolbarButtonTest.
*/
namespace Drupal\ckeditor\Tests;
use Drupal\filter\Entity\FilterFormat;
use Drupal\editor\Entity\Editor;
use Drupal\simpletest\WebTestBase;
use Drupal\Component\Serialization\Json;
/**
* Tests CKEditor toolbar buttons when the language direction is RTL.
*
* @group ckeditor
*/
class CKEditorToolbarButtonTest extends WebTestBase {
/**
* Modules to enable for this test.
*
* @var array
*/
public static $modules = ['filter', 'editor', 'ckeditor', 'locale'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
// Create a text format and associate this with CKEditor.
FilterFormat::create([
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
'filters' => [],
])->save();
Editor::create([
'format' => 'full_html',
'editor' => 'ckeditor',
])->save();
// Create a new user with admin rights.
$this->admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'administer site configuration',
'administer filters',
]);
}
/**
* Method tests CKEditor image buttons.
*/
public function testImageButtonDisplay() {
$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), '"');
};
Scott Reeves
committed
$markup = $json_encode(file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png')));