File: table.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 (34 lines) | stat: -rw-r--r-- 1,437 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
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: enterkey,entities,table,toolbar */

bender.editor = true;
bender.test(
{
	setUp : function() {
		this.mode = this.editor.config.enterMode;
	},

	enterKey : function( html ) {
		var bot = this.editorBot;
		bot.setHtmlWithSelection( html );
		bot.execCommand( 'enter' );
		return bot.getData( false, true ).replace( /<p>&nbsp;<\/p>$/, '' );
	},

	'test enter key inside of table cell': function() {
		if ( this.mode == CKEDITOR.ENTER_P ) {
			// Block established in block-less table cells.
			assert.areSame( '<table><tbody><tr><td><p>foo</p><p>&nbsp;</p></td></tr></tbody></table>', this.enterKey( '<table><tr><td>foo^</td></tr></table>' ) );
			assert.areSame( '<table><tbody><tr><td><p>&nbsp;</p><p>foo</p></td></tr></tbody></table>', this.enterKey( '<table><tr><td>^foo</td></tr></table>' ) );
		}
		if ( this.mode == CKEDITOR.ENTER_BR ) {
			assert.areSame( '<table><tbody><tr><td>foo<br />&nbsp;</td></tr></tbody></table>', this.enterKey( '<table><tr><td>foo^</td></tr></table>' ) );
			assert.areSame( '<table><tbody><tr><td><br />foo</td></tr></tbody></table>', this.enterKey( '<table><tr><td>^foo</td></tr></table>' ) );
		}

		// BR break inside of caption.
		assert.areSame( '<table><caption><p>foo</p><p>bar</p></caption><tbody><tr><td>bar</td></tr></tbody></table>',
						this.enterKey( '<table><caption>foo^bar</caption><tr><td>bar</td></tr></table>' ) );
	}

} );