瀏覽代碼

Improved test.

Oskar Wróbel 8 年之前
父節點
當前提交
69f4a2cd1d
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

+ 5 - 2
packages/ckeditor5-ui/tests/panel/balloon/balloonpanelview.js

@@ -406,14 +406,17 @@ describe( 'BalloonPanelView', () => {
 	} );
 
 	describe( 'keepAttachedTo()', () => {
-		let attachToSpy, target, limiter, notRelatedElement;
+		let attachToSpy, target, targetParent, limiter, notRelatedElement;
 
 		beforeEach( () => {
 			attachToSpy = testUtils.sinon.spy( view, 'attachTo' );
 			limiter = document.createElement( 'div' );
+			targetParent = document.createElement( 'div' );
 			target = document.createElement( 'div' );
 			notRelatedElement = document.createElement( 'div' );
 
+			targetParent.appendChild( target );
+			document.body.appendChild( targetParent );
 			document.body.appendChild( limiter );
 			document.body.appendChild( notRelatedElement );
 		} );
@@ -430,7 +433,7 @@ describe( 'BalloonPanelView', () => {
 			sinon.assert.calledOnce( attachToSpy );
 			sinon.assert.calledWith( attachToSpy.lastCall, { target, limiter } );
 
-			document.dispatchEvent( new Event( 'scroll' ) );
+			targetParent.dispatchEvent( new Event( 'scroll' ) );
 
 			sinon.assert.calledTwice( attachToSpy );
 			sinon.assert.calledWith( attachToSpy.lastCall, { target, limiter } );