|
|
@@ -37,8 +37,8 @@ describe( 'ContextualToolbar', () => {
|
|
|
balloon = editor.plugins.get( ContextualBalloon );
|
|
|
|
|
|
// There is no point to execute BalloonPanelView attachTo and pin methods so lets override it.
|
|
|
- sandbox.stub( balloon.view, 'attachTo', () => {} );
|
|
|
- sandbox.stub( balloon.view, 'pin', () => {} );
|
|
|
+ sandbox.stub( balloon.view, 'attachTo' ).returns( {} );
|
|
|
+ sandbox.stub( balloon.view, 'pin' ).returns( {} );
|
|
|
|
|
|
// Focus the engine.
|
|
|
editor.editing.view.isFocused = true;
|
|
|
@@ -276,7 +276,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
let removeBalloonSpy;
|
|
|
|
|
|
beforeEach( () => {
|
|
|
- removeBalloonSpy = sandbox.stub( balloon, 'remove', () => {} );
|
|
|
+ removeBalloonSpy = sandbox.stub( balloon, 'remove' ).returns( {} );
|
|
|
editor.editing.view.isFocused = true;
|
|
|
} );
|
|
|
|
|
|
@@ -397,8 +397,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
|
|
|
contextualToolbar.fire( '_selectionChangeDebounced' );
|
|
|
|
|
|
- // Stubbing getters doesn't wor for sandbox.
|
|
|
- const stub = sinon.stub( balloon, 'visibleView', { get: () => contextualToolbar.toolbarView } );
|
|
|
+ const stub = sinon.stub( balloon, 'visibleView' ).get( () => contextualToolbar.toolbarView );
|
|
|
|
|
|
sinon.assert.calledOnce( showPanelSpy );
|
|
|
sinon.assert.notCalled( hidePanelSpy );
|
|
|
@@ -416,8 +415,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
|
|
|
contextualToolbar.fire( '_selectionChangeDebounced' );
|
|
|
|
|
|
- // Stubbing getters doesn't wor for sandbox.
|
|
|
- const stub = sinon.stub( balloon, 'visibleView', { get: () => null } );
|
|
|
+ const stub = sinon.stub( balloon, 'visibleView' ).get( () => null );
|
|
|
|
|
|
sinon.assert.calledOnce( showPanelSpy );
|
|
|
sinon.assert.notCalled( hidePanelSpy );
|
|
|
@@ -459,7 +457,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
const originalViewRangeToDom = editingView.domConverter.viewRangeToDom;
|
|
|
|
|
|
// Mock selection rect.
|
|
|
- sandbox.stub( editingView.domConverter, 'viewRangeToDom', ( ...args ) => {
|
|
|
+ sandbox.stub( editingView.domConverter, 'viewRangeToDom' ).callsFake( ( ...args ) => {
|
|
|
const domRange = originalViewRangeToDom.apply( editingView.domConverter, args );
|
|
|
|
|
|
sandbox.stub( domRange, 'getClientRects' )
|