|
|
@@ -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 count = utils.count;
|
|
|
|
|
|
describe( 'utils', () => {
|
|
|
describe( 'spy', () => {
|
|
|
@@ -123,7 +122,7 @@ describe( 'utils', () => {
|
|
|
it( 'should create map from object', () => {
|
|
|
const map = utils.toMap( { foo: 1, bar: 2 } );
|
|
|
|
|
|
- expect( getIteratorCount( map ) ).to.equal( 2 );
|
|
|
+ expect( count( map ) ).to.equal( 2 );
|
|
|
expect( map.get( 'foo' ) ).to.equal( 1 );
|
|
|
expect( map.get( 'bar' ) ).to.equal( 2 );
|
|
|
} );
|
|
|
@@ -131,7 +130,7 @@ describe( 'utils', () => {
|
|
|
it( 'should create map from iterator', () => {
|
|
|
const map = utils.toMap( [ [ 'foo', 1 ], [ 'bar', 2 ] ] );
|
|
|
|
|
|
- expect( getIteratorCount( map ) ).to.equal( 2 );
|
|
|
+ expect( count( map ) ).to.equal( 2 );
|
|
|
expect( map.get( 'foo' ) ).to.equal( 1 );
|
|
|
expect( map.get( 'bar' ) ).to.equal( 2 );
|
|
|
} );
|
|
|
@@ -141,7 +140,7 @@ describe( 'utils', () => {
|
|
|
|
|
|
const map = utils.toMap( data );
|
|
|
|
|
|
- expect( getIteratorCount( map ) ).to.equal( 2 );
|
|
|
+ expect( count( map ) ).to.equal( 2 );
|
|
|
expect( map.get( 'foo' ) ).to.equal( 1 );
|
|
|
expect( map.get( 'bar' ) ).to.equal( 2 );
|
|
|
} );
|
|
|
@@ -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() {
|