public function CKEditorToolbarButtonTest::testImageButtonDisplay in Drupal 9
Same name and namespace in other branches
- 8 core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php \Drupal\Tests\ckeditor\Functional\CKEditorToolbarButtonTest::testImageButtonDisplay()
Method tests CKEditor image buttons.
File
- core/
modules/ ckeditor/ tests/ src/ Functional/ CKEditorToolbarButtonTest.php, line 59
Class
- CKEditorToolbarButtonTest
- Tests CKEditor toolbar buttons when the language direction is RTL.
Namespace
Drupal\Tests\ckeditor\FunctionalCode
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
->drupalGet('admin/config/regional/language/add');
$this
->submitForm($edit, 'Add language');
$edit = [
'site_default_language' => 'ar',
];
$this
->drupalGet('admin/config/regional/language');
$this
->submitForm($edit, '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), '"');
};
/** @var \Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator */
$file_url_generator = \Drupal::service('file_url_generator');
$markup = $json_encode($file_url_generator
->generateString('core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png'));
$this
->assertSession()
->responseContains($markup);
}