瀏覽代碼

Removed getIteratorCount method from test utils. It is also needed outside tests so it is moved to utils.utils#count().

Szymon Kupś 9 年之前
父節點
當前提交
a1c972233e

+ 0 - 18
packages/ckeditor5-utils/tests/_utils/utils.js

@@ -11,24 +11,6 @@ import EmitterMixin from '/ckeditor5/utils/emittermixin.js';
 
 const utils = {
 	/**
-	 * Returns the number of elements return by the iterator.
-	 *
-	 *		testUtils.getIteratorCount( [ 1, 2, 3, 4, 5 ] ); // 5;
-	 *
-	 * @param {Iterable.<*>} iterator Any iterator.
-	 * @returns {Number} Number of elements returned by that iterator.
-	 */
-	getIteratorCount( iterator ) {
-		let count = 0;
-
-		for ( let _ of iterator ) { // jshint ignore:line
-			count++;
-		}
-
-		return count;
-	},
-
-	/**
 	 * Creates an instance inheriting from {@link utils.EmitterMixin} with one additional method `observe()`.
 	 * It allows observing changes to attributes in objects being {@link utils.Observable observable}.
 	 *

+ 0 - 7
packages/ckeditor5-utils/tests/utils-tests/utils.js

@@ -12,13 +12,6 @@ import EmitterMixin from '/ckeditor5/utils/emittermixin.js';
 
 testUtils.createSinonSandbox();
 
-describe( 'utilsTestUtils.getIteratorCount()', () => {
-	it( 'should returns number of editable items', () => {
-		const count = utilsTestUtils.getIteratorCount( [ 1, 2, 3, 4, 5 ] );
-		expect( count ).to.equal( 5 );
-	} );
-} );
-
 describe( 'utilsTestUtils.createObserver()', () => {
 	let observable, observable2, observer;
 

+ 8 - 2
packages/ckeditor5-utils/tests/utils.js

@@ -6,9 +6,8 @@
 'use strict';
 
 import utils from '/ckeditor5/utils/utils.js';
-import utilsTestUtils from '/tests/utils/_utils/utils.js';
 
-const getIteratorCount = utilsTestUtils.getIteratorCount;
+const getIteratorCount = utils.count;
 
 describe( 'utils', () => {
 	describe( 'spy', () => {
@@ -190,6 +189,13 @@ describe( 'utils', () => {
 		}
 	} );
 
+	describe( 'count', () => {
+		it( 'should returns number of editable items', () => {
+			const count = utils.count( [ 1, 2, 3, 4, 5 ] );
+			expect( count ).to.equal( 5 );
+		} );
+	} );
+
 	describe( 'mix', () => {
 		const MixinA = {
 			a() {