8
0
فهرست منبع

Intenral (utils): Fixed type returned by Rect#getBoundingRect().

Marek Lewandowski 5 سال پیش
والد
کامیت
f863b19b77
2فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 1 1
      packages/ckeditor5-utils/src/dom/rect.js
  2. 5 0
      packages/ckeditor5-utils/tests/dom/rect.js

+ 1 - 1
packages/ckeditor5-utils/src/dom/rect.js

@@ -414,7 +414,7 @@ export default class Rect {
 		boundingRectData.width = boundingRectData.right - boundingRectData.left;
 		boundingRectData.height = boundingRectData.bottom - boundingRectData.top;
 
-		return boundingRectData;
+		return new Rect( boundingRectData );
 	}
 }
 

+ 5 - 0
packages/ckeditor5-utils/tests/dom/rect.js

@@ -1133,6 +1133,11 @@ describe( 'Rect', () => {
 			const rectangles = new Set( [ new Rect( geometry ) ] );
 			assertRect( Rect.getBoundingRect( rectangles ), geometry );
 		} );
+
+		it( 'should return proper type', () => {
+			const rectangles = new Set( [ new Rect( geometry ) ] );
+			expect( Rect.getBoundingRect( rectangles ) ).to.be.instanceOf( Rect );
+		} );
 	} );
 } );