瀏覽代碼

Merge pull request #29 from cksource/t/28

Added CKEDITOR.isDebug property.
Piotrek Koszuliński 10 年之前
父節點
當前提交
f2c4744fa3
共有 3 個文件被更改,包括 28 次插入1 次删除
  1. 17 0
      ckeditor.js
  2. 3 1
      src/ckeditor-dev.js
  3. 8 0
      tests/ckeditor/ckeditor.js

+ 17 - 0
ckeditor.js

@@ -39,6 +39,23 @@
 		basePath: getBasePath(),
 
 		/**
+		 * Whether the app should work in the "debug mode" (aka "verbose mode").
+		 *
+		 * You can use the `CKEDITOR.isDebug` condition in order to wrap code that should be removed in the build version:
+		 *
+		 *		if ( CKEDITOR.isDebug ) {
+		 *			if ( doSomeSuperUnnecessaryDebugChecks() ) {
+		 *				throw new CKEditorError( 'sth-broke: Kaboom!' );
+		 *			}
+		 *		}
+		 *
+		 * See also {@link #isDev}.
+		 *
+		 * @property
+		 */
+		isDebug: true,
+
+		/**
 		 * Defines an AMD module.
 		 *
 		 * See https://github.com/ckeditor/ckeditor5-design/wiki/AMD for more details about our AMD API.

+ 3 - 1
src/ckeditor-dev.js

@@ -14,7 +14,9 @@ define( 'ckeditor-dev', function() {
 		 *
 		 * This property is not defined in production (compiled, build code).
 		 *
-		 * @memberof CKEditor
+		 * See also {@link #isDebug}.
+		 *
+		 * @member CKEDITOR
 		 */
 		isDev: true,
 

+ 8 - 0
tests/ckeditor/ckeditor.js

@@ -40,3 +40,11 @@ describe( 'getPluginPath()', function() {
 		expect( path ).to.equal( basePath + 'plugins/test/' );
 	} );
 } );
+
+describe( 'isDebug', function() {
+	it( 'is a boolean', function() {
+		var CKEDITOR = modules.ckeditor;
+
+		expect( CKEDITOR.isDebug ).to.be.a( 'boolean' );
+	} );
+} );