rooteditableelement.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. import ContainerElement from '/ckeditor5/engine/view/containerelement.js';
  7. import EditableElement from '/ckeditor5/engine/view/editableelement.js';
  8. import RootEditableElement from '/ckeditor5/engine/view/rooteditableelement.js';
  9. import createDocumentMock from '/tests/engine/view/_utils/createdocumentmock.js';
  10. describe( 'RootEditableElement', () => {
  11. describe( 'constructor', () => {
  12. it( 'should create an element with default root name', () => {
  13. const root = new RootEditableElement( createDocumentMock(), 'div' );
  14. expect( root ).to.be.instanceof( EditableElement );
  15. expect( root ).to.be.instanceof( ContainerElement );
  16. expect( root.rootName ).to.equal( 'main' );
  17. expect( root.name ).to.equal( 'div' );
  18. expect( root.isFocused ).to.be.false;
  19. expect( root.isReadOnly ).to.be.false;
  20. } );
  21. it( 'should create an element with custom root name', () => {
  22. const root = new RootEditableElement( createDocumentMock(), 'h1', 'header' );
  23. expect( root.rootName ).to.equal( 'header' );
  24. expect( root.name ).to.equal( 'h1' );
  25. expect( root.isFocused ).to.be.false;
  26. expect( root.isReadOnly ).to.be.false;
  27. } );
  28. } );
  29. } );