|
@@ -5,7 +5,7 @@
|
|
|
|
|
|
|
|
import InlineEditorUIView from '../src/inlineeditoruiview';
|
|
import InlineEditorUIView from '../src/inlineeditoruiview';
|
|
|
import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
|
|
import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
|
|
|
-import FloatingPanelView from '@ckeditor/ckeditor5-ui/src/panel/floating/floatingpanelview';
|
|
|
|
|
|
|
+import BalloonPanelView from '@ckeditor/ckeditor5-ui/src/panel/balloon/balloonpanelview';
|
|
|
import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview';
|
|
import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview';
|
|
|
import Locale from '@ckeditor/ckeditor5-utils/src/locale';
|
|
import Locale from '@ckeditor/ckeditor5-utils/src/locale';
|
|
|
|
|
|
|
@@ -30,7 +30,7 @@ describe( 'InlineEditorUIView', () => {
|
|
|
|
|
|
|
|
describe( '#panel', () => {
|
|
describe( '#panel', () => {
|
|
|
it( 'is created', () => {
|
|
it( 'is created', () => {
|
|
|
- expect( view.panel ).to.be.instanceof( FloatingPanelView );
|
|
|
|
|
|
|
+ expect( view.panel ).to.be.instanceof( BalloonPanelView );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'is given a locale object', () => {
|
|
it( 'is given a locale object', () => {
|
|
@@ -44,6 +44,10 @@ describe( 'InlineEditorUIView', () => {
|
|
|
it( 'is put into the #body collection', () => {
|
|
it( 'is put into the #body collection', () => {
|
|
|
expect( view.body.get( 0 ) ).to.equal( view.panel );
|
|
expect( view.body.get( 0 ) ).to.equal( view.panel );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'gets view.panel#withArrow set', () => {
|
|
|
|
|
+ expect( view.panel.withArrow ).to.be.false;
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( '#editable', () => {
|
|
describe( '#editable', () => {
|
|
@@ -67,7 +71,7 @@ describe( 'InlineEditorUIView', () => {
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- describe( 'init', () => {
|
|
|
|
|
|
|
+ describe( 'init()', () => {
|
|
|
it( 'appends #toolbar to panel#content', () => {
|
|
it( 'appends #toolbar to panel#content', () => {
|
|
|
expect( view.panel.content ).to.have.length( 0 );
|
|
expect( view.panel.content ).to.have.length( 0 );
|
|
|
|
|
|
|
@@ -88,4 +92,52 @@ describe( 'InlineEditorUIView', () => {
|
|
|
.then( () => view.destroy() );
|
|
.then( () => view.destroy() );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ describe( 'panelPositions', () => {
|
|
|
|
|
+ it( 'returns the right positions in the right order', () => {
|
|
|
|
|
+ const positions = view.panelPositions;
|
|
|
|
|
+ const editableRect = {
|
|
|
|
|
+ top: 100,
|
|
|
|
|
+ bottom: 200,
|
|
|
|
|
+ left: 100,
|
|
|
|
|
+ right: 100,
|
|
|
|
|
+ width: 100,
|
|
|
|
|
+ height: 100
|
|
|
|
|
+ };
|
|
|
|
|
+ const panelRect = {
|
|
|
|
|
+ top: 0,
|
|
|
|
|
+ bottom: 0,
|
|
|
|
|
+ left: 0,
|
|
|
|
|
+ right: 0,
|
|
|
|
|
+ width: 50,
|
|
|
|
|
+ height: 50
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ expect( positions ).to.have.length( 4 );
|
|
|
|
|
+
|
|
|
|
|
+ expect( positions[ 0 ]( editableRect, panelRect ) ).to.deep.equal( {
|
|
|
|
|
+ name: 'toolbar_nw',
|
|
|
|
|
+ left: 100,
|
|
|
|
|
+ top: 50
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ expect( positions[ 1 ]( editableRect, panelRect ) ).to.deep.equal( {
|
|
|
|
|
+ name: 'toolbar_sw',
|
|
|
|
|
+ left: 100,
|
|
|
|
|
+ top: 200
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ expect( positions[ 2 ]( editableRect, panelRect ) ).to.deep.equal( {
|
|
|
|
|
+ name: 'toolbar_ne',
|
|
|
|
|
+ left: 150,
|
|
|
|
|
+ top: 50
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ expect( positions[ 3 ]( editableRect, panelRect ) ).to.deep.equal( {
|
|
|
|
|
+ name: 'toolbar_se',
|
|
|
|
|
+ left: 150,
|
|
|
|
|
+ top: 200
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|