|
@@ -47,7 +47,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
sandbox.stub( balloon.view, 'pin' ).returns( {} );
|
|
sandbox.stub( balloon.view, 'pin' ).returns( {} );
|
|
|
|
|
|
|
|
// Focus the engine.
|
|
// Focus the engine.
|
|
|
- editingView.isFocused = true;
|
|
|
|
|
|
|
+ editingView.document.isFocused = true;
|
|
|
editingView.getDomRoot().focus();
|
|
editingView.getDomRoot().focus();
|
|
|
|
|
|
|
|
// Remove all selection ranges from DOM before testing.
|
|
// Remove all selection ranges from DOM before testing.
|
|
@@ -170,7 +170,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
] );
|
|
] );
|
|
|
|
|
|
|
|
balloonAddSpy = sandbox.spy( balloon, 'add' );
|
|
balloonAddSpy = sandbox.spy( balloon, 'add' );
|
|
|
- editingView.isFocused = true;
|
|
|
|
|
|
|
+ editingView.document.isFocused = true;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should add #toolbarView to the #_balloon and attach the #_balloon to the selection for the forward selection', () => {
|
|
it( 'should add #toolbarView to the #_balloon and attach the #_balloon to the selection for the forward selection', () => {
|
|
@@ -242,7 +242,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
expect( balloonAddSpy.firstCall.args[ 0 ].position.target() ).to.deep.equal( backwardSelectionRect );
|
|
expect( balloonAddSpy.firstCall.args[ 0 ].position.target() ).to.deep.equal( backwardSelectionRect );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- it( 'should update balloon position on ViewDocument#render event while balloon is added to the #_balloon', () => {
|
|
|
|
|
|
|
+ it( 'should update balloon position on view#change event while balloon is added to the #_balloon', () => {
|
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
|
|
|
|
|
|
const spy = sandbox.spy( balloon, 'updatePosition' );
|
|
const spy = sandbox.spy( balloon, 'updatePosition' );
|
|
@@ -296,7 +296,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
|
|
|
|
|
it( 'should not be called when the editor is not focused', () => {
|
|
it( 'should not be called when the editor is not focused', () => {
|
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
|
- editingView.isFocused = false;
|
|
|
|
|
|
|
+ editingView.document.isFocused = false;
|
|
|
|
|
|
|
|
contextualToolbar.fire( '_selectionChangeDebounced' );
|
|
contextualToolbar.fire( '_selectionChangeDebounced' );
|
|
|
sinon.assert.notCalled( showSpy );
|
|
sinon.assert.notCalled( showSpy );
|
|
@@ -311,7 +311,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
|
|
|
|
|
it( 'should be called when the selection is not collapsed and editor is focused', () => {
|
|
it( 'should be called when the selection is not collapsed and editor is focused', () => {
|
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
|
- editingView.isFocused = true;
|
|
|
|
|
|
|
+ editingView.document.isFocused = true;
|
|
|
|
|
|
|
|
contextualToolbar.fire( '_selectionChangeDebounced' );
|
|
contextualToolbar.fire( '_selectionChangeDebounced' );
|
|
|
sinon.assert.calledOnce( showSpy );
|
|
sinon.assert.calledOnce( showSpy );
|
|
@@ -324,7 +324,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
|
|
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
|
removeBalloonSpy = sandbox.stub( balloon, 'remove' ).returns( {} );
|
|
removeBalloonSpy = sandbox.stub( balloon, 'remove' ).returns( {} );
|
|
|
- editingView.isFocused = true;
|
|
|
|
|
|
|
+ editingView.document.isFocused = true;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should remove #toolbarView from the #_balloon', () => {
|
|
it( 'should remove #toolbarView from the #_balloon', () => {
|
|
@@ -336,7 +336,7 @@ describe( 'ContextualToolbar', () => {
|
|
|
sinon.assert.calledWithExactly( removeBalloonSpy, contextualToolbar.toolbarView );
|
|
sinon.assert.calledWithExactly( removeBalloonSpy, contextualToolbar.toolbarView );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- it( 'should stop update balloon position on ViewDocument#render event', () => {
|
|
|
|
|
|
|
+ it( 'should stop update balloon position on ViewDocument#change event', () => {
|
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
setData( model, '<paragraph>b[a]r</paragraph>' );
|
|
|
|
|
|
|
|
const spy = sandbox.spy( balloon, 'updatePosition' );
|
|
const spy = sandbox.spy( balloon, 'updatePosition' );
|