File: button.js

package info (click to toggle)
ckeditor 4.11.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 93,632 kB
  • sloc: sh: 184; makefile: 59; python: 37; php: 15; xml: 5
file content (45 lines) | stat: -rw-r--r-- 1,288 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
41
42
43
44
45
/* bender-tags: editor */
/* bender-ckeditor-plugins: button,toolbar */

var customCls = 'my_btn';

bender.editor = {
	config: {
		toolbar: [ [ 'custom_btn', 'expandable_btn' ] ],
		on: {
			pluginsLoaded: function( evt ) {
				var ed = evt.editor;
				ed.ui.addButton( 'custom_btn', {
					label: 'button with custom class',
					className: customCls
				} );

				ed.ui.addButton( 'expandable_btn', {
					label: 'expandable button',
					hasArrow: true
				} );
			}
		}
	}
};

bender.test( {
	'test button class names': function() {
		var btn = this.editor.ui.get( 'custom_btn' ),
		btnEl = CKEDITOR.document.getById( btn._.id );

		assert.isTrue( btnEl.hasClass( 'cke_button' ), 'check ui type class name' );
		assert.isTrue( btnEl.hasClass( 'cke_button__custom_btn' ), 'check named ui type class name' );
		assert.isTrue( btnEl.hasClass( customCls ), 'check ui item custom class name' );
		// (#2483)
		assert.isFalse( btnEl.hasClass( 'cke_button_expandable' ), 'check ui item expandable class name' );
	},

	// (#2483)
	'test expandable button class name': function() {
		var btn = this.editor.ui.get( 'expandable_btn' ),
		btnEl = CKEDITOR.document.getById( btn._.id );

		assert.isTrue( btnEl.hasClass( 'cke_button_expandable' ), 'check ui item expandable class name' );
	}
} );