Index: /CKEditor/branches/tests/editor/plugins/jquery/jquery.html
===================================================================
--- /CKEditor/branches/tests/editor/plugins/jquery/jquery.html	(revision 4096)
+++ /CKEditor/branches/tests/editor/plugins/jquery/jquery.html	(revision 4097)
@@ -392,4 +392,88 @@
 			testSelf.wait( function() {
 				cleanup( 'div_replace' );
+				assert.isTrue( testFinished, 'Test not finished.' );
+			}, testTimeout);
+		},
+
+		test_parallel_callbacks : function()
+		{
+			var testSelf = this,
+				testFinished = false;
+
+			var called = [ false, false ];
+			function checkCalled()
+			{
+				if ( called[ 0 ] && called[ 1 ] )
+				{
+					testSelf.resume( function()
+					{
+						var editor = jQuery( '#parallel_callbacks' ).ckeditorGet();
+						editor.dataProcessor.writer._.rules = {};
+						var content = editor.getData();
+
+						assert.isTrue( !!content.match( 'callback1' ), 'callback1' );
+						assert.isTrue( !!content.match( 'callback2' ), 'callback2' );
+						// TODO cleanup here causes checkSelectionChange and other timeouted events to fail!
+						cleanup( 'parallel_callbacks' );
+					});
+				}
+			}
+
+			function callback1()
+			{
+				this.insertElement( CKEDITOR.dom.element.createFromHtml( '<p>callback1</p>' ) );
+				called[ 0 ] = true;
+				checkCalled();
+			}
+
+			function callback2()
+			{
+				this.insertElement( CKEDITOR.dom.element.createFromHtml( '<p>callback2</p>' ) );
+				called[ 1 ] = true;
+				checkCalled();
+			}
+
+			jQuery( '#parallel_callbacks' )
+				.ckeditor( callback1 )
+				.ckeditor( callback2 );
+
+			testSelf.wait( function() {
+				cleanup( 'parallel_callbacks' );
+				assert.isTrue( testFinished, 'Test not finished.' );
+			}, testTimeout);
+		},
+
+		test_series_callbacks : function()
+		{
+			var testSelf = this,
+				testFinished = false;
+
+			function callback1( element )
+			{
+				this.insertElement( CKEDITOR.dom.element.createFromHtml( '<p>callback1</p>' ) );
+				jQuery( element ).ckeditor( callback2 );
+			}
+
+			function callback2()
+			{
+				var editor = this;
+				testSelf.resume( function()
+				{
+					editor.insertElement( CKEDITOR.dom.element.createFromHtml( '<p>callback2</p>' ) );
+
+					// Assert.
+					editor.dataProcessor.writer._.rules = {};
+					var content = editor.getData();
+
+					assert.isTrue( !!content.match( 'callback1' ), 'callback1' );
+					assert.isTrue( !!content.match( 'callback2' ), 'callback2' );
+					cleanup( 'series_callbacks' );
+				} );
+			}
+
+			jQuery( '#series_callbacks' ).ckeditor( callback1 );
+
+			testSelf.wait( function() {
+				cleanup( 'series_callbacks' );
 				assert.isTrue( testFinished, 'Test not finished.' );
 			}, testTimeout);
@@ -415,4 +499,6 @@
 			<textarea rows="10" cols="30" id="global_event">default</textarea>
 			<textarea rows="10" cols="30" id="setData_event">default</textarea>
+			<textarea rows="10" cols="30" id="parallel_callbacks">default</textarea>
+			<textarea rows="10" cols="30" id="series_callbacks">default</textarea>
 		</form>
 		<form action="./" method="post" id="submit">
