|
@@ -5,17 +5,25 @@
|
|
|
|
|
|
|
|
/* globals document */
|
|
/* globals document */
|
|
|
|
|
|
|
|
|
|
+import EditingView from '@ckeditor/ckeditor5-engine/src/view/view';
|
|
|
|
|
+import ViewRootEditableElement from '@ckeditor/ckeditor5-engine/src/view/rooteditableelement';
|
|
|
import InlineEditableUIView from '../../../src/editableui/inline/inlineeditableuiview';
|
|
import InlineEditableUIView from '../../../src/editableui/inline/inlineeditableuiview';
|
|
|
import Locale from '@ckeditor/ckeditor5-utils/src/locale';
|
|
import Locale from '@ckeditor/ckeditor5-utils/src/locale';
|
|
|
|
|
|
|
|
describe( 'InlineEditableUIView', () => {
|
|
describe( 'InlineEditableUIView', () => {
|
|
|
- let view, editableElement, locale;
|
|
|
|
|
|
|
+ let view, editableElement, editingView, editingViewRoot, locale;
|
|
|
|
|
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
|
locale = new Locale( 'en' );
|
|
locale = new Locale( 'en' );
|
|
|
editableElement = document.createElement( 'div' );
|
|
editableElement = document.createElement( 'div' );
|
|
|
|
|
|
|
|
- view = new InlineEditableUIView( locale );
|
|
|
|
|
|
|
+ editingView = new EditingView();
|
|
|
|
|
+ editingViewRoot = new ViewRootEditableElement( 'div' );
|
|
|
|
|
+ editingViewRoot._document = editingView.document;
|
|
|
|
|
+ editingView.document.roots.add( editingViewRoot );
|
|
|
|
|
+ view = new InlineEditableUIView( locale, editingView );
|
|
|
|
|
+ view.name = editingViewRoot.rootName;
|
|
|
|
|
+
|
|
|
view.render();
|
|
view.render();
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -24,12 +32,8 @@ describe( 'InlineEditableUIView', () => {
|
|
|
expect( view.locale ).to.equal( locale );
|
|
expect( view.locale ).to.equal( locale );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- it( 'sets initial values of attributes', () => {
|
|
|
|
|
- expect( view.name ).to.be.null;
|
|
|
|
|
- } );
|
|
|
|
|
-
|
|
|
|
|
it( 'accepts editableElement', () => {
|
|
it( 'accepts editableElement', () => {
|
|
|
- view = new InlineEditableUIView( locale, editableElement );
|
|
|
|
|
|
|
+ view = new InlineEditableUIView( locale, editingView, editableElement );
|
|
|
|
|
|
|
|
expect( view._editableElement ).to.equal( editableElement );
|
|
expect( view._editableElement ).to.equal( editableElement );
|
|
|
} );
|
|
} );
|
|
@@ -40,18 +44,14 @@ describe( 'InlineEditableUIView', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( 'editableElement', () => {
|
|
describe( 'editableElement', () => {
|
|
|
- const ariaLabel = 'Rich Text Editor, foo';
|
|
|
|
|
-
|
|
|
|
|
- beforeEach( () => {
|
|
|
|
|
- view.name = 'foo';
|
|
|
|
|
- } );
|
|
|
|
|
|
|
+ const ariaLabel = 'Rich Text Editor, main';
|
|
|
|
|
|
|
|
it( 'has proper accessibility role', () => {
|
|
it( 'has proper accessibility role', () => {
|
|
|
expect( view.element.attributes.getNamedItem( 'role' ).value ).to.equal( 'textbox' );
|
|
expect( view.element.attributes.getNamedItem( 'role' ).value ).to.equal( 'textbox' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'has proper ARIA label', () => {
|
|
it( 'has proper ARIA label', () => {
|
|
|
- expect( view.element.getAttribute( 'aria-label' ) ).to.equal( ariaLabel );
|
|
|
|
|
|
|
+ expect( editingViewRoot.getAttribute( 'aria-label' ) ).to.equal( ariaLabel );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'has proper class name', () => {
|
|
it( 'has proper class name', () => {
|