- <?php
- * @file
- * Tests for ckeditor.module.
- */
-
- * CKEditor testing class specific for right-to-left languages.
- */
- class CKEditor5RtlTestCase extends BackdropWebTestCase {
-
- * User object.
- *
- * @var User
- */
- protected $adminUser;
-
-
- * Profile name.
- *
- * @var string
- */
- protected $profile = 'standard';
-
-
- * Set up environment.
- */
- public function setUp() {
- parent::setUp(array('ckeditor5', 'language', 'locale'));
-
- $arabic = (object) array(
- 'langcode' => 'ar',
- 'name' => 'Arabic',
- 'direction' => LANGUAGE_RTL,
- );
- language_save($arabic);
-
-
- config_set('system.core', 'error_level', 'all');
-
-
- $this->adminUser = $this->backdropCreateUser(array(
- 'administer filters',
- 'access administration pages',
- 'access content',
- 'administer nodes',
- ));
- $this->backdropLogin($this->adminUser);
- }
-
-
- * Test that the CKEditor admin form works correctly with RTL languages.
- */
- public function testRtlAdminIcons() {
- $arabic = language_load('ar');
- $notice = '<em class="placeholder">Notice</em>: Undefined index: image_rtl in <em class="placeholder">{closure}()</em>';
-
- $this->backdropGet('admin/config/content/formats/filtered_html', array('language' => $arabic));
-
- $this->assertNoRaw($notice, '"Notice: Undefined index: image_rtl in {closure}()" not found');
-
-
- $script_tag = $this->xpath('//script[contains(text(), :string)]', array(':string' => 'window.Backdrop'));
- $js_settings = (string) $script_tag[0];
-
- $icons = array(
- 'bulleted-list' => 'ckeditor5\\\/icons\\\/bulleted-list-rtl.svg',
- 'numbered-list' => 'ckeditor5\\\/icons\\\/numbered-list-rtl.svg',
- 'undo' => 'ckeditor5\\\/icons\\\/undo-rtl.svg',
- 'redo' => 'ckeditor5\\\/icons\\\/redo-rtl.svg',
- );
-
- foreach ($icons as $name => $icon) {
- $this->assertTrue(preg_match('#' . $icon . '#', $js_settings, $matches), format_string('Image src found for %icon', array('%icon' => $name)));
- }
- }
-
- }