textproxy.js 1.0 KB

123456789101112131415161718192021222324252627282930
  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. 'use strict';
  7. import TextProxy from '/ckeditor5/engine/view/textproxy.js';
  8. import Text from '/ckeditor5/engine/view/text.js';
  9. import ContainerElement from '/ckeditor5/engine/view/containerelement.js';
  10. describe( 'TextProxy', () => {
  11. describe( 'constructor', () => {
  12. it( 'should create TextProxy instance with specified properties', () => {
  13. const text = new Text( 'abcdefgh' );
  14. const paragraph = new ContainerElement( 'p', [], [ text ] );
  15. const textFragment = 'cdef';
  16. const index = 2;
  17. const textProxy = new TextProxy( textFragment, paragraph, text, index );
  18. expect( textProxy ).to.have.property( 'parent' ).to.equal( paragraph );
  19. expect( textProxy ).to.have.property( '_data' ).to.equal( textFragment );
  20. expect( textProxy ).to.have.property( '_textNodeParent' ).to.equal( text );
  21. expect( textProxy ).to.have.property( '_index' ).to.equal( index );
  22. } );
  23. } );
  24. } );