Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it( 'uses default position configuration if not specified', () => {
const spy = testUtils.sinon.stub( ContextualBalloon.prototype, 'add' );
const positionData = {};
setData( doc, '[<img src="">]' );
plugin.add( positionData );
sinon.assert.calledWithExactly( spy, {
position: {
target: editingView.domConverter.viewToDom( editingView.selection.getSelectedElement() ),
positions: [
BalloonPanelView.defaultPositions.northArrowSouth,
BalloonPanelView.defaultPositions.southArrowNorth
]
}
} );
expect( positionData.position ).to.be.undefined;
it( 'should remove all remaining views', () => {
setData( doc, '[<img src="">]' );
testUtils.sinon.stub( ContextualBalloon.prototype, 'add' );
const removeSpy = testUtils.sinon.stub( ContextualBalloon.prototype, 'remove' );
const positionDataA = { view: {} };
const positionDataB = { view: {} };
const positionDataC = { view: {} };
plugin.add( positionDataA );
plugin.add( positionDataB );
plugin.add( positionDataC );
plugin.remove( positionDataB.view );
plugin.clear();
sinon.assert.calledThrice( removeSpy );
sinon.assert.calledWithExactly( removeSpy.firstCall, positionDataC.view );
sinon.assert.calledWithExactly( removeSpy.secondCall, positionDataA.view );
} );