8
0

utils.js 888 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import treeModelTestUtils from '/tests/core/treemodel/_utils/utils.js';
  7. import Document from '/ckeditor5/core/treemodel/document.js';
  8. import Range from '/ckeditor5/core/treemodel/range.js';
  9. import Element from '/ckeditor5/core/treemodel/element.js';
  10. const getNodesAndText = treeModelTestUtils.getNodesAndText;
  11. describe( 'getNodesAndText', () => {
  12. let doc, root, div, p;
  13. beforeEach( () => {
  14. doc = new Document();
  15. root = doc.createRoot( 'root' );
  16. div = new Element( 'div', [], 'foobar' );
  17. p = new Element( 'p', [], 'abcxyz' );
  18. root.insertChildren( 0, [ div, p ] );
  19. } );
  20. it( 'reads two elements with text', () => {
  21. expect( getNodesAndText( Range.createFromElement( root ) ) ).to.equal( 'DIVfoobarDIVPabcxyzP' );
  22. } );
  23. } );