Skip to content

Commit

Permalink
Tests: Added tests for hypothetical problem described in #12546.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Oct 14, 2014
1 parent eeb7d60 commit 6322d11
Showing 1 changed file with 92 additions and 1 deletion.
93 changes: 92 additions & 1 deletion tests/plugins/dialog/plugin.js
Expand Up @@ -55,6 +55,8 @@ bender.test(
tc.wait();
},

// Code of this test is poor (checking isVisible and operations on DOM), but that's caused
// by very closed and poor dialog API.
'test dialog\'s field are disabled when not allowed': function() {
var ed = this.editor,
tc = this;
Expand Down Expand Up @@ -135,7 +137,96 @@ bender.test(
dialog.selectPage( 'tab3' );
assert.isTrue( dialog.getContentElement( 'tab3', 'bim' ).getInputElement().isVisible() );

dialog.getButton( 'ok' ).click();
wait( function() {
dialog.getButton( 'cancel' ).click();
}, 100 );
} );
}, 200 );
} );
wait();
},

// Code of this test is poor (checking isVisible and operations on DOM), but that's caused
// by very closed and poor dialog API.
// #12546
'test dialog\'s HTML field always count as allowed field unless requiredContent is specified': function() {
var ed = this.editor,
tc = this;

CKEDITOR.dialog.add( 'testDialog4', function() {
return {
title: 'Test Dialog 4',
contents: [
{
id: 'tab1',
label: 'Test 1',
elements: [
{
type: 'html',
id: 'field1',
html: 'foo'
}
]
},
{
id: 'tab2a',
label: 'Test 2a',
elements: [
{
type: 'html',
id: 'field2a',
html: 'foo',
requiredContent: 'x'
}
]
},
{
id: 'tab2b',
label: 'Test 2b',
elements: [
{
type: 'html',
id: 'field2b',
html: 'foo',
requiredContent: 'p'
}
]
},
{
id: 'tab3',
label: 'Test 3',
requiredContent: 'y',
elements: [
{
type: 'html',
id: 'field3',
html: 'foo'
}
]
}
]
};
} );

ed.openDialog( 'testDialog4', function( dialog ) {
setTimeout( function() {
resume( function() {
assert.areSame( 2, dialog.getPageCount() );
assert.isTrue( dialog.parts.tabs.getChild( 0 ).isVisible(), 'tab1' );
// Tab 2a is hidden.
assert.isFalse( dialog.parts.tabs.getChild( 1 ).isVisible(), 'tab2a' );
assert.isTrue( dialog.parts.tabs.getChild( 2 ).isVisible(), 'tab2b' );
// Tab 3 wasn't created at all.
assert.isNull( dialog.parts.tabs.getChild( 3 ), 'tab3' );

assert.isTrue( dialog.getContentElement( 'tab1', 'field1' ).getInputElement().isVisible(), 'field1' );

dialog.selectPage( 'tab2b' );
assert.isTrue( dialog.getContentElement( 'tab2b', 'field2b' ).getInputElement().isVisible(), 'field2b' );

wait( function() {
dialog.getButton( 'cancel' ).click();
}, 100 );
} );
}, 200 );
} );
Expand Down

0 comments on commit 6322d11

Please sign in to comment.