assets/ckeditor/tests/plugins/imagebase/features/caption.js
/* Simulate focusing and blurring group of image widgets with captions, asserting caption visibility
	 * during each step. Assertions are made for every widget in the group.
	 *
	 * @param {Object} options
	 * @param {String} options.fixture Fixture's id.
	 * @param {Number} options.widgetsCount Number of widgets to test.
	 * @param {Boolean} options.initial Caption visibility at the start of the test.
	 * @param {Boolean} options.focus Caption visibility after calling focus function.
	 */
Simulate focusing and blurring group of image widgets with captions, asserting caption visibility
during each step. Assertions are made for every widget in the group.

@param {Object} options
@param {String} options.fixture Fixture's id.
@param {Number} options.widgetsCount Number of widgets to test.
@param {Boolean} options.initial Caption visibility at the start of the test.
@param {Boolean} options.focus Caption visibility after calling focus function.
Simulate focusing and blurring group of image widgets with captions asserting caption visibility during each step . Assertions are made for every widget in the group . @param { Object } options @param { String } options . fixture Fixture ' s id . @param { Number } options . widgetsCount Number of widgets to test . @param { Boolean } options . initial Caption visibility at the start of the test . @param { Boolean } options . focus Caption visibility after calling focus function .
function createMultipleToggleTest( options ) {
		return function( editor, bot ) {
			addTestWidget( editor );
			function assertMultipleVisibility( widgets, expected, msg, callback, i ) {
				var widget;
				i = i || 0;
				widget = widgets[ i ];
				assertVisibility( widget.parts.caption, expected[ i ], 'caption#' + i + ' visibility (' + msg + ')',
					function() {
						if ( i === widgets.length - 1 ) {
							if ( callback ) {
								callback();
							}
							return;
						}
						assertMultipleVisibility( widgets, expected, msg, callback, ++i );
					} );
			}
			function assertOnFocus( widgets, expected, i ) {
				var widget;
				i = i || 0;
				widget = widgets[ i ];
				setTimeout( function() {
					resume( function() {
						assertMultipleVisibility( widgets, expected[ i ], 'focus widget#' + i, function() {
							if ( i === widgets.length - 1 ) {
								return;
							}
							assertOnFocus( widgets, expected, ++i );
						} );
					} );
				}, 50 );
				widget.focus();
				wait();
			}
			bot.setData( getFixture( options.fixture ), function() {
				var widgets = bender.tools.objToArray( editor.widgets.instances ).slice( 0, options.widgetsCount );
				assertMultipleVisibility( widgets, options.initial, 'initial' );
				assertOnFocus( widgets, options.focus );
			} );
		};
	}
function createMultipleToggleTest ( options ) { return function ( editor , bot ) { addTestWidget ( editor ) ; function assertMultipleVisibility ( widgets , expected , msg , callback , i ) { var widget ; i = i || 0 ; widget = widgets [ i ] ; assertVisibility ( widget . parts . caption , expected [ i ] , 'caption#' + i + ' visibility (' + msg + ')' , function ( ) { if ( i === widgets . length - 1 ) { if ( callback ) { callback ( ) ; } return ; } assertMultipleVisibility ( widgets , expected , msg , callback , ++ i ) ; } ) ; } function assertOnFocus ( widgets , expected , i ) { var widget ; i = i || 0 ; widget = widgets [ i ] ; setTimeout ( function ( ) { resume ( function ( ) { assertMultipleVisibility ( widgets , expected [ i ] , 'focus widget#' + i , function ( ) { if ( i === widgets . length - 1 ) { return ; } assertOnFocus ( widgets , expected , ++ i ) ; } ) ; } ) ; } , 50 ) ; widget . focus ( ) ; wait ( ) ; } bot . setData ( getFixture ( options . fixture ) , function ( ) { var widgets = bender . tools . objToArray ( editor . widgets . instances ) . slice ( 0 , options . widgetsCount ) ; assertMultipleVisibility ( widgets , options . initial , 'initial' ) ; assertOnFocus ( widgets , options . focus ) ; } ) ; } ; }
Simulate focusing and blurring group of image widgets with captions, asserting caption visibility
 during each step.
Simulate focusing and blurring group of image widgets with captions asserting caption visibility during each step .