浏览代码

Docs: Update `testUtils.createSinonSandbox` description.

Maciej Gołaszewski 7 年之前
父节点
当前提交
01d03cb76d
共有 1 个文件被更改,包括 14 次插入7 次删除
  1. 14 7
      packages/ckeditor5-core/tests/_utils/utils.js

+ 14 - 7
packages/ckeditor5-core/tests/_utils/utils.js

@@ -8,20 +8,27 @@
  */
 const utils = {
 	/**
-	 * Creates Sinon sandbox in {@link bender#sinon} and plugs `afterEach()` callback which
+	 * Creates Sinon sandbox in {@link utils#sinon} and plugs `afterEach()` callback which
 	 * restores all spies and stubs created in this sandbox.
 	 *
 	 * See https://github.com/ckeditor/ckeditor5-design/issues/72 and http://sinonjs.org/docs/#sinon-sandbox
 	 *
 	 * Usage:
 	 *
-	 *		// Directly in the test file:
-	 *		testUtils.createSinonSandbox();
+	 *		import testUtils from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 	 *
-	 *		// Then inside tests you can use bender.sinon:
-	 *		it( 'does something', () => {
-	 *			testUtils.sinon.spy( obj, 'method' );
-	 *		} );
+	 *		describe( 'MyClass', () => {
+	 *			// Create Sinon sandbox inside top-level describe block:
+	 *			testUtils.createSinonSandbox();
+	 *
+	 *			// Then inside tests you can use testUtils.sinon:
+	 *			it( 'does something', () => {
+	 *				testUtils.sinon.spy( obj, 'method' );
+	 *			} );
+	 *		}
+	 *
+	 * **Note**: Do not use `testUtils.createSinonSandbox()` outside `describe()` block as it will attach `afterEach()` calls
+	 * to all test - not only those in current file.
 	 */
 	createSinonSandbox() {
 		before( () => {