Browse Source

Re-introduced bender.amd.require() - a tool to easily require CKEditor modules in tests.

fredck 11 years ago
parent
commit
a8afa0ac20
1 changed files with 30 additions and 0 deletions
  1. 30 0
      dev/bender/plugins/ckeditor5/static/extensions.js

+ 30 - 0
dev/bender/plugins/ckeditor5/static/extensions.js

@@ -13,4 +13,34 @@
 
 	// Wait for the "ckeditor" module to be ready to start testing.
 	CKEDITOR.require( [ 'ckeditor' ], done );
+
+	/**
+	 * AMD tools related to CKEditor.
+	 */
+	bender.amd = {
+		/**
+		 * Gets and object which holds the CKEditor modules guaranteed to be loaded before tests start.
+		 *
+		 * @params {...String} module The name of the module to load.
+		 * @returns {Object} The object that will hold the loaded modules.
+		 */
+		require: function() {
+			var modules = {};
+
+			var done = bender.defer();
+
+			var names = [].slice.call( arguments );
+
+			CKEDITOR.require( names, function() {
+				for ( var i = 0; i < names.length; i++ ) {
+					modules[ names[ i ] ] = arguments[ i ] ;
+				}
+
+				// Finally give green light for tests to start.
+				done();
+			} );
+
+			return modules;
+		}
+	};
 } )();