File: source.js

package info (click to toggle)
ckeditor 4.4.4%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 25,632 kB
  • ctags: 2,419
  • sloc: sh: 190; python: 37; makefile: 29; php: 15; xml: 5
file content (40 lines) | stat: -rw-r--r-- 1,204 bytes parent folder | download
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
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: sourcearea */

	CKEDITOR.disableAutoInline = true;
	var doc = CKEDITOR.document,
		tools = bender.tools;

	bender.editor = { creator: 'replace', config: { startupMode: 'source' } };

	// This group of tests plays upon the source area editable.
	bender.test(
	{
		// Test all editable APIs.
		testFocus : function() {
			var editor = this.editor;
			var editable = editor.editable();

			assert.isTrue( editable.hasClass( 'cke_editable' ) );

			editor.focus();
			assert.isTrue( this.editor.focusManager.hasFocus );

			doc.getById( 'text_input' ).focus();
			// Focus manager blurring is asynchronous.
			this.wait( function() { assert.isFalse( editor.focusManager.hasFocus ); }, 200 );
		},

		testData : function() {
			var editor = this.editor;
			editor.setData( '<p>foo</p>' );
			assert.areSame( '<p>foo</p>', tools.compatHtml( editor.editable().getValue() ), 'set data' );
			assert.areSame( '<p>foo</p>', tools.compatHtml( editor.getData() ), 'retrieve data' );
		},

		testDetach: function() {
			var editable = this.editor.editable();
			this.editor.editable( null );
			assert.isFalse( editable.hasClass( 'cke_editable' ) );
		}
} );