Explorar el Código

Added test for Class.extend() with prototype and statics options.

fredck hace 11 años
padre
commit
9cccfd6a22
Se han modificado 1 ficheros con 24 adiciones y 0 borrados
  1. 24 0
      packages/ckeditor5-engine/tests/utils/utils.js

+ 24 - 0
packages/ckeditor5-engine/tests/utils/utils.js

@@ -76,6 +76,30 @@ describe( 'extendMixin', function() {
 		expect( falcon ).to.have.property( 'loadContainers' ).to.be.a( 'function' );
 		expect( falcon ).to.have.property( 'jumpToHyperspace' ).to.be.a( 'function' );
 	} );
+
+	it( 'should extend the prototype and add statics', function() {
+		var utils = modules.utils;
+
+		function Car() {}
+
+		Car.extend = utils.extendMixin;
+
+		var Truck = Car.extend( {
+			property1: 1,
+			property2: function() {}
+		}, {
+			static1: 1,
+			static2: function() {}
+		} );
+
+		expect( Truck ).to.have.property( 'static1' ).to.equals( 1 );
+		expect( Truck ).to.have.property( 'static2' ).to.be.a( 'function' );
+
+		var truck = new Truck();
+
+		expect( truck ).to.have.property( 'property1' ).to.equals( 1 );
+		expect( truck ).to.have.property( 'property2' ).to.be.a( 'function' );
+	} );
 } );
 
 describe( 'spy', function() {