containerelement.js 1.0 KB

123456789101112131415161718192021222324252627282930
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import ContainerElement from 'ckeditor5-engine/src/view/containerelement';
  6. import Element from 'ckeditor5-engine/src/view/element';
  7. import { parse } from 'ckeditor5-engine/src/dev-utils/view';
  8. describe( 'ContainerElement', () => {
  9. describe( 'constructor()', () => {
  10. it( 'should create element with default priority', () => {
  11. const el = new ContainerElement( 'p' );
  12. expect( el ).to.be.an.instanceof( ContainerElement );
  13. expect( el ).to.be.an.instanceof( Element );
  14. expect( el ).to.have.property( 'name' ).that.equals( 'p' );
  15. } );
  16. } );
  17. describe( 'getFillerOffset', () => {
  18. it( 'should return position 0 if element is empty', () => {
  19. expect( parse( '<container:p></container:p>' ).getFillerOffset() ).to.equals( 0 );
  20. } );
  21. it( 'should return null if element is not empty', () => {
  22. expect( parse( '<container:p>foo</container:p>' ).getFillerOffset() ).to.be.null;
  23. } );
  24. } );
  25. } );