File: textarea.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 (66 lines) | stat: -rw-r--r-- 1,836 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: forms,toolbar */

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

bender.test(
{
	test_createFillFields : function() {
		var editorBot = this.editorBot;

		editorBot.setHtmlWithSelection( '<p>^</p>' );

		editorBot.dialog( 'textarea', function( dialog ) {
				dialog.setValueOf( 'info', '_cke_saved_name', 'test_textarea' );
				dialog.setValueOf( 'info', 'cols', 80 );
				dialog.setValueOf( 'info', 'rows', 5 );
				dialog.setValueOf( 'info', 'value', 'Some testing value.' );

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

				assert.areSame( '<p><textarea cols="80" name="test_textarea" rows="5">some testing value.</textarea></p>', editorBot.getData( true ) );
			} );
	},

	test_createSimple : function() {
		var editorBot = this.editorBot;

		editorBot.setHtmlWithSelection( '<p>^</p>' );

		editorBot.dialog( 'textarea', function( dialog ) {
				dialog.getButton( 'ok' ).click();
				assert.areSame( '<p><textarea></textarea></p>', editorBot.getData() );
			} );
	},

	test_specialValues: function() {
		var values = [
			'<HTML> content: <textarea>sample</textarea> tag.',
			'Line 1\nLine 2',
			'    Spaces before.',
			'Spaces after.   ' ];

		var editorBot = this.editorBot,
			currentIndex = 0;

		function testValue( index ) {
			var value = values[ index ];

			if ( !value )
				return;

			editorBot.setHtmlWithSelection( '<p>^</p>' );

			editorBot.dialog( 'textarea', function( dialog ) {
					dialog.setValueOf( 'info', 'value', value );
					dialog.getButton( 'ok' ).click();

					assert.areSame( '<p><textarea>' + value.replace( /</g, '&lt;' ).replace( />/g, '&gt;' ) + '</textarea></p>', editorBot.getData().replace( '\r\n', '\n' ) );
					testValue.call( this, ++currentIndex );
				} );
		}

		// Start testing.
		testValue.call( this, 0 );
	}
} );