Parcourir la source

Revert "Reviewed tests to use bender.amd.require()."

This reverts commit 41ec3ce42fd0deb22b86ef926fc1491e83ec4590.
fredck il y a 11 ans
Parent
commit
907ef34748
3 fichiers modifiés avec 42 ajouts et 37 suppressions
  1. 0 3
      gruntfile.js
  2. 14 10
      tests/ckeditor/basepath.js
  3. 28 24
      tests/ckeditor/ckeditor.js

+ 0 - 3
gruntfile.js

@@ -18,9 +18,6 @@ module.exports = function( grunt ) {
 
 		jshint: {
 			options: {
-				globals: {
-					'bender': false
-				},
 				ignores: ignoreFiles
 			}
 		},

+ 14 - 10
tests/ckeditor/basepath.js

@@ -3,12 +3,10 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals beforeEach, describe, it, expect, window, document */
+/* globals beforeEach, describe, it, expect, CKEDITOR, window, document */
 
 'use strict';
 
-bender.amd.require( 'ckeditor' );
-
 beforeEach( function() {
 	// Ensure that no CKEDITOR_BASEPATH global is available.
 	delete window.CKEDITOR_BASEPATH;
@@ -17,15 +15,21 @@ beforeEach( function() {
 	removeScripts();
 } );
 
-describe( 'basePath', function( CKEDITOR ) {
-	it( 'should work with script tags', function() {
-		addScript( 'http://bar.com/ckeditor/ckeditor.js' );
-		expect( CKEDITOR._getBasePath() ).to.equal( 'http://bar.com/ckeditor/' );
+describe( 'basePath', function() {
+	it( 'should work with script tags', function( done ) {
+		CKEDITOR.require( [ 'ckeditor' ], function( CKEDITOR ) {
+			addScript( 'http://bar.com/ckeditor/ckeditor.js' );
+			expect( CKEDITOR._getBasePath() ).to.equal( 'http://bar.com/ckeditor/' );
+			done();
+		} );
 	} );
 
-	it( 'should work with the CKEDITOR_BASEPATH global', function() {
-		window.CKEDITOR_BASEPATH = 'http://foo.com/ckeditor/';
-		expect( CKEDITOR._getBasePath() ).to.equal( 'http://foo.com/ckeditor/' );
+	it( 'should work with the CKEDITOR_BASEPATH global', function( done ) {
+		CKEDITOR.require( [ 'ckeditor' ], function( CKEDITOR ) {
+			window.CKEDITOR_BASEPATH = 'http://foo.com/ckeditor/';
+			expect( CKEDITOR._getBasePath() ).to.equal( 'http://foo.com/ckeditor/' );
+			done();
+		} );
 	} );
 } );
 

+ 28 - 24
tests/ckeditor/ckeditor.js

@@ -3,37 +3,41 @@
  * For licensing, see LICENSE.md.
  */
 
-/* globals describe, it, expect */
+/* globals describe, it, expect, CKEDITOR */
 
 'use strict';
 
-bender.amd.require( 'ckeditor', 'ckeditor-core' );
-
-describe( 'getPluginPath()', function( CKEDITOR, core ) {
-	it( 'should return a proper path', function() {
-		var basePath = CKEDITOR.basePath;
-		var path = CKEDITOR.getPluginPath( 'test' );
-
-		if ( CKEDITOR.isDev ) {
-			expect( path ).to.equal( basePath + 'node_modules/ckeditor-plugin-test/src/' );
-		} else {
-			expect( path ).to.equal( basePath + 'plugins/test/' );
-		}
+describe( 'getPluginPath()', function() {
+	it( 'should return a proper path', function( done ) {
+		CKEDITOR.require( [ 'ckeditor' ], function( CKEDITOR ) {
+			var basePath = CKEDITOR.basePath;
+			var path = CKEDITOR.getPluginPath( 'test' );
+
+			if ( CKEDITOR.isDev ) {
+				expect( path ).to.equal( basePath + 'node_modules/ckeditor-plugin-test/src/' );
+			} else {
+				expect( path ).to.equal( basePath + 'plugins/test/' );
+			}
+			done();
+		} );
 	} );
 
-	it( '(the production version) should work even when in dev', function() {
-		// To be able to run this test on both dev and production code, we need to override getPluginPath with the
-		// core version of it and restore it after testing.
-		var originalGetPluginPath = CKEDITOR.getPluginPath;
-		CKEDITOR.getPluginPath = core.getPluginPath;
+	it( '(the production version) should work even when in dev', function( done ) {
+		CKEDITOR.require( [ 'ckeditor', 'ckeditor-core' ], function( CKEDITOR, core ) {
+			// To be able to run this test on both dev and production code, we need to override getPluginPath with the
+			// core version of it and restore it after testing.
+			var originalGetPluginPath = CKEDITOR.getPluginPath;
+			CKEDITOR.getPluginPath = core.getPluginPath;
 
-		// This test is good for both the development and production codes.
-		var basePath = CKEDITOR.basePath;
-		var path = CKEDITOR.getPluginPath( 'test' );
+			// This test is good for both the development and production codes.
+			var basePath = CKEDITOR.basePath;
+			var path = CKEDITOR.getPluginPath( 'test' );
 
-		// Revert the override before assertions or it will not do it in case of errors.
-		CKEDITOR.getPluginPath = originalGetPluginPath;
+			// Revert the override before assertions or it will not do it in case of errors.
+			CKEDITOR.getPluginPath = originalGetPluginPath;
 
-		expect( path ).to.equal( basePath + 'plugins/test/' );
+			expect( path ).to.equal( basePath + 'plugins/test/' );
+			done();
+		} );
 	} );
 } );