File: preview.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 (29 lines) | stat: -rw-r--r-- 691 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
/* bender-tags: editor */
/* bender-ckeditor-plugins: preview */

bender.editor = {
	startupData: '<p>Foo</p>'
};

bender.test( {
	'test processing of data on contentPreview': function() {
		var tc = this,
			editor = tc.editor;

		editor.once( 'contentPreview', function( event ) {
			event.data.dataValue = event.data.dataValue.replace( 'Foo', 'Bar' );
		}, null, null, 1 );

		editor.once( 'contentPreview', function( event ) {
			tc.resume( function() {
				assert.isArray( event.data.dataValue.match( '<p>Bar</p>' ), 'Content has been altered.' );
			} );

			event.cancel();	// Don't open preview window.
		}, null, null, 2 );

		editor.execCommand( 'preview' );

		tc.wait();
	}
} );