File: plugin.js

package info (click to toggle)
ckeditor 4.16.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 258,804 kB
  • sloc: javascript: 239,590; sh: 184; makefile: 64; python: 37; php: 15; xml: 5
file content (43 lines) | stat: -rw-r--r-- 1,453 bytes parent folder | download | duplicates (4)
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
/* bender-tags: editor */
/* bender-ckeditor-plugins: format,toolbar */

bender.editor = true;

bender.test( {
	'test apply format style': function() {
		var bot = this.editorBot, ed = this.editor;
		bot.setHtmlWithSelection( '<p>^foo</p>' );
		var name = 'Format', combo = ed.ui.get( name );
		assert.areSame( CKEDITOR.TRISTATE_OFF, combo._.state, 'check state OFF' );
		bot.combo( name, function( combo ) {
			assert.areSame( CKEDITOR.TRISTATE_ON, combo._.state, 'check state ON when opened' );
			combo.onClick( 'h1' );
			assert.areSame( '<h1>^foo</h1>', bot.htmlWithSelection(), 'applied h1 block style' );
		} );
	},

	'test format style not in context': function() {
		// TODO: IE throws selection inside of form legend.
		if ( CKEDITOR.env.ie )
			assert.ignore();

		var bot = this.editorBot, ed = this.editor;
		bot.setHtmlWithSelection( '<fieldset><legend>^foo</legend><form>bar</form></fieldset>' );
		var name = 'Format', combo = ed.ui.get( name );
		assert.areSame( CKEDITOR.TRISTATE_DISABLED, combo._.state, 'check state disabled when not in context' );
	},

	// Drop-down format menu should not be toggleable (#584).
	'test apply format style to preformated text': function() {
		var bot = this.editorBot;

		bot.setHtmlWithSelection( '<h1>f^oo</h1>' );

		// Preserved h1 block style.
		bot.combo( 'Format', function( combo ) {
			combo.onClick( 'h1' );
			assert.areSame( '<h1>f^oo</h1>', bot.htmlWithSelection() );
		} );
	}

} );