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

Commit ae98cfd

Browse files
authored
Merge pull request #74 from ckeditor/t/ckeditor5-core/130
Other: Used the `EditorUI` as a parent class for the `ClassicEditorUI` (see ckeditor/ckeditor5-core#130).
2 parents bf6d997 + e53f808 commit ae98cfd

File tree

2 files changed

+8
-62
lines changed

2 files changed

+8
-62
lines changed

src/classiceditorui.js

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,21 @@
77
* @module editor-classic/classiceditorui
88
*/
99

10-
import ComponentFactory from '@ckeditor/ckeditor5-ui/src/componentfactory';
11-
import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
10+
import EditorUI from '@ckeditor/ckeditor5-core/src/editor/editorui';
1211
import enableToolbarKeyboardFocus from '@ckeditor/ckeditor5-ui/src/toolbar/enabletoolbarkeyboardfocus';
1312
import normalizeToolbarConfig from '@ckeditor/ckeditor5-ui/src/toolbar/normalizetoolbarconfig';
1413

1514
/**
1615
* The classic editor UI class.
1716
*
18-
* @implements module:core/editor/editorui~EditorUI
17+
* @extends module:core/editor/editorui~EditorUI
1918
*/
20-
export default class ClassicEditorUI {
19+
export default class ClassicEditorUI extends EditorUI {
2120
/**
22-
* Creates an instance of the editor UI class.
23-
*
24-
* @param {module:core/editor/editor~Editor} editor The editor instance.
25-
* @param {module:ui/editorui/editoruiview~EditorUIView} view The view of the UI.
21+
* @inheritDoc
2622
*/
2723
constructor( editor, view ) {
28-
/**
29-
* @inheritDoc
30-
*/
31-
this.editor = editor;
32-
33-
/**
34-
* @inheritDoc
35-
*/
36-
this.view = view;
37-
38-
/**
39-
* @inheritDoc
40-
*/
41-
this.componentFactory = new ComponentFactory( editor );
42-
43-
/**
44-
* @inheritDoc
45-
*/
46-
this.focusTracker = new FocusTracker();
24+
super( editor, view );
4725

4826
/**
4927
* A normalized `config.toolbar` object.
@@ -88,11 +66,4 @@ export default class ClassicEditorUI {
8866
toolbar: this.view.toolbar
8967
} );
9068
}
91-
92-
/**
93-
* Destroys the UI.
94-
*/
95-
destroy() {
96-
this.view.destroy();
97-
}
9869
}

tests/classiceditorui.js

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55

66
/* globals document, Event */
77

8-
import ComponentFactory from '@ckeditor/ckeditor5-ui/src/componentfactory';
98
import View from '@ckeditor/ckeditor5-ui/src/view';
109

1110
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
1211
import ClassicEditorUI from '../src/classiceditorui';
12+
import EditorUI from '@ckeditor/ckeditor5-core/src/editor/editorui';
1313
import ClassicEditorUIView from '../src/classiceditoruiview';
1414

15-
import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
16-
1715
import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
1816
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
1917
import utils from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
@@ -41,20 +39,8 @@ describe( 'ClassicEditorUI', () => {
4139
} );
4240

4341
describe( 'constructor()', () => {
44-
it( 'sets #editor', () => {
45-
expect( ui.editor ).to.equal( editor );
46-
} );
47-
48-
it( 'sets #view', () => {
49-
expect( ui.view ).to.be.instanceOf( ClassicEditorUIView );
50-
} );
51-
52-
it( 'creates #componentFactory factory', () => {
53-
expect( ui.componentFactory ).to.be.instanceOf( ComponentFactory );
54-
} );
55-
56-
it( 'creates #focusTracker', () => {
57-
expect( ui.focusTracker ).to.be.instanceOf( FocusTracker );
42+
it( 'extends EditorUI', () => {
43+
expect( ui ).to.instanceof( EditorUI );
5844
} );
5945
} );
6046

@@ -192,17 +178,6 @@ describe( 'ClassicEditorUI', () => {
192178
} );
193179
} );
194180
} );
195-
196-
describe( 'destroy()', () => {
197-
it( 'destroys the #view', () => {
198-
const spy = sinon.spy( view, 'destroy' );
199-
200-
return editor.destroy()
201-
.then( () => {
202-
sinon.assert.calledOnce( spy );
203-
} );
204-
} );
205-
} );
206181
} );
207182

208183
function viewCreator( name ) {

0 commit comments

Comments
 (0)