8
0

text.js 1010 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* bender-tags: treemodel */
  6. 'use strict';
  7. import Text from '/ckeditor5/core/treemodel/text.js';
  8. import Attribute from '/ckeditor5/core/treemodel/attribute.js';
  9. import AttributeList from '/ckeditor5/core/treemodel/attributelist.js';
  10. describe( 'Text', () => {
  11. describe( 'constructor', () => {
  12. it( 'should create character without attributes', () => {
  13. let attrs = [ new Attribute( 'bold', true ) ];
  14. let text = new Text( 'bar', attrs );
  15. expect( text ).to.have.property( 'text' ).that.equals( 'bar' );
  16. expect( text ).to.have.property( '_attrs' ).that.is.instanceof( AttributeList );
  17. expect( Array.from( text._attrs ) ).to.deep.equal( attrs );
  18. } );
  19. it( 'should create empty text object', () => {
  20. let empty1 = new Text();
  21. let empty2 = new Text( '' );
  22. expect( empty1.text ).to.equal( '' );
  23. expect( empty2.text ).to.equal( '' );
  24. } );
  25. } );
  26. } );