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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
/* bender-tags: editor, dialog */
/* 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( {
tearDown: function() {
var dialog = CKEDITOR.dialog.getCurrent();
if ( dialog ) {
dialog.hide();
}
},
'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 );
} );
},
// (#2423)
'test dialog model': function() {
var bot = this.editorBot,
tc = this,
editor = this.editor;
editor.setData( template.output( { title: title1 } ), function() {
tc.resume( function() {
bot.dialog( 'docProps', function( dialog ) {
assert.areEqual( dialog.getModel( editor ), editor.document, 'Dialog model should point at document' );
assert.areEqual( CKEDITOR.dialog.EDITING_MODE, dialog.getMode( editor ), 'Dialog model is in editing mode by default' );
} );
} );
} );
tc.wait();
},
'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();
},
// https://dev.ckeditor.com/ticket/12546
'test preview tab is available': function() {
var bot = this.editorBot;
bot.dialog( 'docProps', function( dialog ) {
var tabs = dialog.parts.tabs.getChildren();
assert.isTrue( !tabs.getItem( 3 ).hasClass( 'cke_dialog_tab_disabled' ), 'Tab preview should be enabled.' );
dialog.getButton( 'ok' ).click();
} );
}
} );
|