Jelajahi Sumber

Added docs to Sandbox class. [skip ci]

Kamil Piechaczek 8 tahun lalu
induk
melakukan
63b070f080
1 mengubah file dengan 10 tambahan dan 0 penghapusan
  1. 10 0
      packages/ckeditor5-engine/src/dev-utils/enableenginedebug.js

+ 10 - 0
packages/ckeditor5-engine/src/dev-utils/enableenginedebug.js

@@ -52,11 +52,20 @@ import Editor from '@ckeditor/ckeditor5-core/src/editor/editor';
 
 
 import clone from '@ckeditor/ckeditor5-utils/src/lib/lodash/clone';
 import clone from '@ckeditor/ckeditor5-utils/src/lib/lodash/clone';
 
 
+// Sandbox class allows creating mocks of the functions and restoring these mocks to the original values.
 class Sandbox {
 class Sandbox {
 	constructor() {
 	constructor() {
+		// An array that contains functions which restore the original values of mocked objects.
+		// @private
+		// @type {Array.<Function>}
 		this._restores = [];
 		this._restores = [];
 	}
 	}
 
 
+	// Creates a new mock.
+	//
+	// @param {Object} object Object to mock.
+	// @param {String} methodName Function to mock.
+	// @param {Function} fakeMethod Function that will be executed.
 	mock( object, methodName, fakeMethod ) {
 	mock( object, methodName, fakeMethod ) {
 		const originalMethod = object[ methodName ];
 		const originalMethod = object[ methodName ];
 
 
@@ -71,6 +80,7 @@ class Sandbox {
 		} );
 		} );
 	}
 	}
 
 
+	// Restores all mocked functions.
 	restore() {
 	restore() {
 		for ( const restore of this._restores ) {
 		for ( const restore of this._restores ) {
 			restore();
 			restore();