text.js 838 B

123456789101112131415161718192021222324252627282930
  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. describe( 'Text', () => {
  9. describe( 'constructor', () => {
  10. it( 'should create character without attributes', () => {
  11. let text = new Text( 'bar', { bold: true } );
  12. expect( text ).to.have.property( 'text' ).that.equals( 'bar' );
  13. expect( text ).to.have.property( '_attrs' ).that.is.instanceof( Map );
  14. expect( Array.from( text._attrs ) ).to.deep.equal( [ [ 'bold', true ] ] );
  15. } );
  16. it( 'should create empty text object', () => {
  17. let empty1 = new Text();
  18. let empty2 = new Text( '' );
  19. expect( empty1.text ).to.equal( '' );
  20. expect( empty2.text ).to.equal( '' );
  21. } );
  22. } );
  23. } );