uielement.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import UIElement from '../../src/view/uielement';
  6. import Element from '../../src/view/element';
  7. describe( 'UIElement', () => {
  8. let childElement, uiElement;
  9. beforeEach( () => {
  10. childElement = new Element( 'b' );
  11. uiElement = new UIElement( 'span', {
  12. foo: 'bar',
  13. style: 'border: 1px solid red;color: white;',
  14. class: 'foo bar'
  15. }, [ childElement ] );
  16. } );
  17. describe( 'constructor()', () => {
  18. it( 'should create instance', () => {
  19. expect( uiElement.name ).to.equal( 'span' );
  20. expect( uiElement.getAttribute( 'foo' ) ).to.equal( 'bar' );
  21. expect( uiElement.getStyle( 'border' ) ).to.equal( '1px solid red' );
  22. expect( uiElement.getStyle( 'color' ) ).to.equal( 'white' );
  23. expect( uiElement.hasClass( 'foo' ) ).to.true;
  24. expect( uiElement.hasClass( 'bar' ) ).to.true;
  25. expect( uiElement.childCount ).to.equal( 1 );
  26. expect( uiElement.getChild( 0 ) ).to.equal( childElement )
  27. } );
  28. } );
  29. describe( 'getFillerOffset()', () => {
  30. it( 'should return null', () => {
  31. expect( uiElement.getFillerOffset() ).to.null;
  32. } );
  33. } );
  34. } );