text.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* bender-tags: treeview */
  6. 'use strict';
  7. const modules = bender.amd.require(
  8. 'core/treeview/node',
  9. 'core/treeview/element',
  10. 'core/treeview/text'
  11. );
  12. describe( 'Element', () => {
  13. let ViewText, ViewElement, ViewNode;
  14. before( () => {
  15. ViewText = modules[ 'core/treeview/text' ];
  16. ViewElement = modules[ 'core/treeview/element' ];
  17. ViewNode = modules[ 'core/treeview/node' ];
  18. } );
  19. describe( 'constructor', () => {
  20. it( 'should create element without attributes', () => {
  21. const text = new ViewText( 'foo' );
  22. expect( text ).to.be.an.instanceof( ViewNode );
  23. expect( text.getText() ).to.equal( 'foo' );
  24. expect( text ).to.have.property( 'parent' ).that.is.null;
  25. } );
  26. } );
  27. describe( 'setText', () => {
  28. it( 'should change the text', () => {
  29. const text = new ViewText( 'foo' );
  30. text.setText( 'bar' );
  31. expect( text.getText() ).to.equal( 'bar' );
  32. } );
  33. } );
  34. } );