Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit c787c0d

Browse files
authored
Merge pull request #306 from ckeditor/t/305
Fix: `ContextualBalloon` should remember position passed to `#updatePosition`. Closes #305. Closes ckeditor/ckeditor5-image#141.
2 parents e1a4d81 + ba50436 commit c787c0d

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/panel/balloon/contextualballoon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export default class ContextualBalloon extends Plugin {
192192
this._stack.get( this.visibleView ).position = position;
193193
}
194194

195-
this.view.attachTo( this._getBalloonPosition() );
195+
this.view.pin( this._getBalloonPosition() );
196196
}
197197

198198
/**

tests/panel/balloon/contextualballoon.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -405,24 +405,24 @@ describe( 'ContextualBalloon', () => {
405405
}
406406
} );
407407

408-
balloon.view.attachTo.reset();
408+
balloon.view.pin.reset();
409409

410410
balloon.updatePosition();
411411

412-
expect( balloon.view.attachTo.calledOnce );
413-
sinon.assert.calledWithMatch( balloon.view.attachTo.firstCall, {
412+
expect( balloon.view.pin.calledOnce );
413+
sinon.assert.calledWithMatch( balloon.view.pin.firstCall, {
414414
target: 'fake',
415415
limiter: balloon.positionLimiter
416416
} );
417417
} );
418418

419419
it( 'should set given position to the currently visible view and use position from the first view in the stack #1', () => {
420-
balloon.view.attachTo.reset();
420+
balloon.view.pin.reset();
421421

422422
balloon.updatePosition( { target: 'new' } );
423423

424-
expect( balloon.view.attachTo.calledOnce );
425-
sinon.assert.calledWithMatch( balloon.view.attachTo.firstCall, {
424+
expect( balloon.view.pin.calledOnce );
425+
sinon.assert.calledWithMatch( balloon.view.pin.firstCall, {
426426
target: 'new',
427427
limiter: balloon.positionLimiter
428428
} );
@@ -436,12 +436,12 @@ describe( 'ContextualBalloon', () => {
436436
}
437437
} );
438438

439-
balloon.view.attachTo.reset();
439+
balloon.view.pin.reset();
440440

441441
balloon.updatePosition( { target: 'new' } );
442442

443-
expect( balloon.view.attachTo.calledOnce );
444-
sinon.assert.calledWithMatch( balloon.view.attachTo.firstCall, {
443+
expect( balloon.view.pin.calledOnce );
444+
sinon.assert.calledWithMatch( balloon.view.pin.firstCall, {
445445
target: 'fake',
446446
limiter: balloon.positionLimiter
447447
} );
@@ -450,23 +450,23 @@ describe( 'ContextualBalloon', () => {
450450

451451
balloon.updatePosition();
452452

453-
expect( balloon.view.attachTo.calledTwice );
454-
sinon.assert.calledWithMatch( balloon.view.attachTo.secondCall, {
453+
expect( balloon.view.pin.calledTwice );
454+
sinon.assert.calledWithMatch( balloon.view.pin.secondCall, {
455455
target: 'new',
456456
limiter: balloon.positionLimiter
457457
} );
458458
} );
459459

460460
it( 'should use a given position limiter instead of the default one', () => {
461-
balloon.view.attachTo.reset();
461+
balloon.view.pin.reset();
462462

463463
balloon.updatePosition( {
464464
target: 'new',
465465
limiter: 'customLimiter'
466466
} );
467467

468-
expect( balloon.view.attachTo.calledOnce );
469-
sinon.assert.calledWithMatch( balloon.view.attachTo.firstCall, {
468+
expect( balloon.view.pin.calledOnce );
469+
sinon.assert.calledWithMatch( balloon.view.pin.firstCall, {
470470
target: 'new',
471471
limiter: 'customLimiter'
472472
} );

0 commit comments

Comments
 (0)