Ver código fonte

Ported some more tests.

Piotrek Koszuliński 10 anos atrás
pai
commit
30a877e6f8

+ 44 - 0
packages/ckeditor5-utils/tests/lodash.js

@@ -0,0 +1,44 @@
+/**
+ * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+'use strict';
+
+const modules = bender.amd.require( 'core/lib/lodash/object' );
+
+describe( 'utils', () => {
+	let objectUtils;
+
+	before( () => {
+		objectUtils = modules[ 'core/lib/lodash/object' ];
+	} );
+
+	describe( 'extend()', () => {
+		// Properties of the subsequent objects should override properties of the preceding objects. This is critical for
+		// CKEditor so we keep this test to ensure that Lo-Dash (or whatever) implements it in the way we need it.
+		it( 'should extend by several params in the correct order', () => {
+			let target = {
+				a: 0,
+				b: 0
+			};
+
+			let ext1 = {
+				b: 1,
+				c: 1
+			};
+
+			let ext2 = {
+				c: 2,
+				d: 2
+			};
+
+			objectUtils.extend( target, ext1, ext2 );
+
+			expect( target ).to.have.property( 'a' ).to.equal( 0 );
+			expect( target ).to.have.property( 'b' ).to.equal( 1 );
+			expect( target ).to.have.property( 'c' ).to.equal( 2 );
+			expect( target ).to.have.property( 'd' ).to.equal( 2 );
+		} );
+	} );
+} );

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

@@ -5,41 +5,13 @@
 
 'use strict';
 
-const modules = bender.amd.require( 'utils', 'utils-lodash' );
+const modules = bender.amd.require( 'core/utils' );
 
 describe( 'utils', () => {
 	let utils;
 
 	before( () => {
-		utils = modules.utils;
-	} );
-
-	describe( 'extend()', () => {
-		// Properties of the subsequent objects should override properties of the preceding objects. This is critical for
-		// CKEditor so we keep this test to ensure that Lo-Dash (or whatever) implements it in the way we need it.
-		it( 'should extend by several params in the correct order', () => {
-			let target = {
-				a: 0,
-				b: 0
-			};
-
-			let ext1 = {
-				b: 1,
-				c: 1
-			};
-
-			let ext2 = {
-				c: 2,
-				d: 2
-			};
-
-			utils.extend( target, ext1, ext2 );
-
-			expect( target ).to.have.property( 'a' ).to.equal( 0 );
-			expect( target ).to.have.property( 'b' ).to.equal( 1 );
-			expect( target ).to.have.property( 'c' ).to.equal( 2 );
-			expect( target ).to.have.property( 'd' ).to.equal( 2 );
-		} );
+		utils = modules[ 'core/utils' ];
 	} );
 
 	describe( 'spy', () => {
@@ -177,16 +149,4 @@ describe( 'utils', () => {
 			yield 33;
 		}
 	} );
-
-	describe( 'Lo-Dash extensions', () => {
-		// Ensures that the required Lo-Dash extensions are available in `utils`.
-		it( 'should be exposed in utils', () => {
-			let utils = modules.utils;
-			let extensions = modules[ 'utils-lodash' ];
-
-			extensions.forEach( ( extension ) => {
-				expect( utils ).to.have.property( extension ).to.not.be.undefined();
-			} );
-		} );
-	} );
 } );