ソースを参照

Added basic tests for AMD.

fredck 11 年 前
コミット
c9ad4d047e
1 ファイル変更31 行追加0 行削除
  1. 31 0
      tests/amd/amd.js

+ 31 - 0
tests/amd/amd.js

@@ -0,0 +1,31 @@
+/**
+ * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals describe, it, expect, CKEDITOR */
+
+'use strict';
+
+CKEDITOR.define( 'testModule', [ 'ckeditor' ], function( ckeditor ) {
+	return {
+		test: ( typeof ckeditor == 'object' )
+	};
+} );
+
+describe( 'amd', function() {
+	it( 'require() should work with defined module', function( done ) {
+		CKEDITOR.require( [ 'testModule' ], function( testModule ) {
+			expect( testModule ).to.have.property( 'test' ).to.be.true();
+
+			done();
+		} );
+	} );
+
+	it( 'require() should work with core module', function( done ) {
+		CKEDITOR.require( [ 'utils' ], function( utils ) {
+			expect( utils ).to.be.an( 'object' );
+			done();
+		} );
+	} );
+} );