forked from backdrop/backdrop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue backdrop#101: Adding update message and tests for CKEditor modu…
…le and new fitlers.
- Loading branch information
1 parent
7a6f29a
commit 339cbbe
Showing
4 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
core/modules/ckeditor5/core/modules/ckeditor/tests/ckeditor.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Tests for ckeditor.module. | ||
*/ | ||
|
||
class CKEditorTestCase extends BackdropWebTestCase { | ||
protected $admin_user; | ||
protected $profile = 'testing'; | ||
|
||
function setUp() { | ||
parent::setUp('ckeditor'); | ||
|
||
// Create Article node type. | ||
$content_type = $this->backdropCreateContentType(array( | ||
'type' => 'article', | ||
'name' => 'Article', | ||
)); | ||
node_add_body_field($content_type); | ||
|
||
// Create and log in as the admin user. | ||
$this->admin_user = $this->backdropCreateUser(array( | ||
'administer filters', | ||
'access administration pages', | ||
'access content', | ||
'administer nodes', | ||
'create article content', | ||
)); | ||
$this->backdropLogin($this->admin_user); | ||
} | ||
|
||
/** | ||
* Test the addition of the library to the page when configured. | ||
* | ||
* With no JavaScript level testing, we can only ensure the library is present | ||
* on the page. | ||
*/ | ||
function testLibrary() { | ||
$this->backdropGet('admin/config/content/formats'); | ||
$this->clickLink(t('Add text editor')); | ||
|
||
// Select CKEditor and refresh the page. | ||
$this->backdropPost(NULL, array( | ||
'name' => 'CKEditor', | ||
'format' => 'ckeditor', | ||
'editor' => 'ckeditor', | ||
'roles[authenticated]' => TRUE, | ||
), t('Configure editor')); | ||
|
||
$toolbar = array( | ||
// First row. | ||
array( | ||
array( | ||
'name' => 'Formatting', | ||
'items' => array('Bold', 'Italic', 'Underline', 'Strike'), | ||
), | ||
array( | ||
'name' => 'Alignment', | ||
'items' => array('JustifyLeft', 'JustifyCenter', 'JustifyRight'), | ||
), | ||
array( | ||
'name' => 'Lists', | ||
'items' => array('BulletedList', 'NumberedList'), | ||
), | ||
array( | ||
'name' => 'Media', | ||
'items' => array('Blockquote', 'BackdropImage', 'Styles'), | ||
), | ||
), | ||
); | ||
|
||
$this->backdropPost(NULL, array( | ||
'editor_settings[toolbar]' => json_encode($toolbar), | ||
'editor_settings[plugins][style][style_list]' => "h1.title|Title\np.custom-class|Custom class\n", | ||
'filters[filter_autop][status]' => TRUE, | ||
'filters[filter_image_align][status]' => TRUE, | ||
'filters[filter_image_caption][status]' => TRUE, | ||
), t('Save configuration')); | ||
|
||
$this->backdropGet('node/add/article'); | ||
$this->assertRaw('ckeditor/css/ckeditor.css'); | ||
$this->assertRaw('misc/ckeditor/ckeditor.js'); | ||
$this->assertRaw('ckeditor/js/ckeditor.js'); | ||
$settings = $this->backdropGetSettings(); | ||
$format_settings = $settings['filter']['formats']['ckeditor']; | ||
$this->assertEqual($format_settings['editorSettings']['toolbar'], $toolbar[0], 'CKEditor toolbar settings saved and added correctly.'); | ||
$this->assertEqual($format_settings['editorSettings']['extraPlugins'], 'backdropimagecaption,backdropimage', 'Added custom plugins include custom image caption support.'); | ||
$style_list = array( | ||
array('name' => 'Title', 'element' => 'h1', 'attributes' => array('class' => 'title')), | ||
array('name' => 'Custom class', 'element' => 'p', 'attributes' => array('class' => 'custom-class')), | ||
); | ||
$this->assertEqual($format_settings['editorSettings']['stylesSet'], $style_list, 'Style list settings correct'); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
core/modules/ckeditor5/core/modules/ckeditor/tests/ckeditor.tests.info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[CKEditorTestCase] | ||
name = CKEditor | ||
description = Check the functionality of CKEditor module. | ||
group = CKEditor | ||
file = ckeditor.test |