rooteditableelement.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* bender-tags: view */
  6. 'use strict';
  7. import ContainerElement from '/ckeditor5/engine/view/containerelement.js';
  8. import EditableElement from '/ckeditor5/engine/view/editableelement.js';
  9. import RootEditableElement from '/ckeditor5/engine/view/rooteditableelement.js';
  10. import createDocumentMock from '/tests/engine/view/_utils/createdocumentmock.js';
  11. describe( 'RootEditableElement', () => {
  12. describe( 'constructor', () => {
  13. it( 'should create an element with default root name', () => {
  14. const root = new RootEditableElement( createDocumentMock(), 'div' );
  15. expect( root ).to.be.instanceof( EditableElement );
  16. expect( root ).to.be.instanceof( ContainerElement );
  17. expect( root.rootName ).to.equal( 'main' );
  18. expect( root.name ).to.equal( 'div' );
  19. expect( root.isFocused ).to.be.false;
  20. expect( root.isReadOnly ).to.be.false;
  21. } );
  22. it( 'should create an element with custom root name', () => {
  23. const root = new RootEditableElement( createDocumentMock(), 'h1', 'header' );
  24. expect( root.rootName ).to.equal( 'header' );
  25. expect( root.name ).to.equal( 'h1' );
  26. expect( root.isFocused ).to.be.false;
  27. expect( root.isReadOnly ).to.be.false;
  28. } );
  29. } );
  30. } );