File: select.js

package info (click to toggle)
ckeditor 4.5.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 30,020 kB
  • sloc: sh: 167; python: 37; makefile: 24; php: 15; xml: 5
file content (53 lines) | stat: -rw-r--r-- 1,774 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
51
52
53
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: dialog,button,forms,htmlwriter,toolbar */

bender.editor = {
	config: {
		autoParagraph: false
	}
};

bender.test( {
	'test fill basic fields': function() {
		var bot = this.editorBot;

		bot.dialog( 'select', function( dialog ) {
			dialog.setValueOf( 'info', 'txtName', 'name' );
			dialog.setValueOf( 'info', 'txtValue', 'value' );
			dialog.setValueOf( 'info', 'txtSize', '8' );
			dialog.setValueOf( 'info', 'required', 'required' );
			dialog.setValueOf( 'info', 'chkMulti', 'checked' );

			dialog.getButton( 'ok' ).click();

			// IE needs delay as it runs asynchronous code in dialog's onOk.
			wait( function() {
				assert.isMatching( '<select multiple="(true|multiple)" name="name" required="required" size="8"></select>', bot.getData( false, true ) );
			}, 10 );
		} );
	},

	'test empty basic fields': function() {
		var bot = this.editorBot;

		bot.setHtmlWithSelection( '[<select multiple="true" name="name" required="required" size="8"></select>]' );

		bot.dialog( 'select', function( dialog ) {
			assert.areSame( 'name', dialog.getValueOf( 'info', 'txtName' ) );
			assert.areSame( '', dialog.getValueOf( 'info', 'txtValue' ) );
			assert.areSame( '8', dialog.getValueOf( 'info', 'txtSize' ) );
			assert.areSame( true, dialog.getValueOf( 'info', 'required' ) );
			assert.areSame( true, dialog.getValueOf( 'info', 'chkMulti' ) );

			dialog.setValueOf( 'info', 'txtName', '' );
			dialog.setValueOf( 'info', 'txtValue', '' );
			dialog.setValueOf( 'info', 'txtSize', '' );
			dialog.setValueOf( 'info', 'required', '' );
			dialog.setValueOf( 'info', 'chkMulti', '' );

			dialog.getButton( 'ok' ).click();

			assert.areSame( '<select></select>', bot.getData( false, true ) );
		} );
	}
} );