File: docprops.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 (43 lines) | stat: -rw-r--r-- 1,356 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
/* bender-tags: editor,unit */
/* bender-ckeditor-plugins: wysiwygarea,sourcearea,dialog,toolbar,docprops */

bender.editor = { config: { fullPage: 1 } };

var title1 = 'Document title',
	title2 = 'Another document title',
	template = new CKEDITOR.template( '<html><head><title>{title}</title></head><body></body></html>' );

bender.test( {
	'test set page title with dialog': function() {
		var bot = this.editorBot,
			tc = this,
			editor = this.editor;

		bot.dialog( 'docProps', function( dialog ) {
			dialog.setValueOf( 'general', 'title', title1 );
			dialog.getButton( 'ok' ).click();

			tc.wait( function() {
				var title = editor.document.getElementsByTag( 'title' ).getItem( 0 );
				assert.areEqual( title1, title.data( 'cke-title' ), 'Title cke-data attribute has been set.' );
				assert.areEqual( template.output( { title: title1 } ), editor.getData(), 'Page title is set in editor data.' );
			}, 0 );
		} );
	},

	'test read page title into dialog': function() {
		var bot = this.editorBot,
			tc = this,
			editor = this.editor;

		editor.setData( template.output( { title: title2 } ), function() {
			tc.resume( function() {
				bot.dialog( 'docProps', function( dialog ) {
					assert.areSame( title2, dialog.getValueOf( 'general', 'title', 'Page title has been loaded into dialog.' ) );
				} );
			} );
		} );

		tc.wait();
	}
} );