virtualtesteditor.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 StandardEditor from '/ckeditor5/editor/standardeditor.js';
  7. import VirtualTestEditor from '/tests/ckeditor5/_utils/virtualtesteditor.js';
  8. import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
  9. import testUtils from '/tests/ckeditor5/_utils/utils.js';
  10. testUtils.createSinonSandbox();
  11. describe( 'VirtualTestEditor', () => {
  12. describe( 'constructor', () => {
  13. it( 'creates an instance of editor', () => {
  14. const editor = new VirtualTestEditor( { foo: 1 } );
  15. expect( editor ).to.be.instanceof( StandardEditor );
  16. expect( editor.config.get( 'foo' ) ).to.equal( 1 );
  17. } );
  18. it( 'creates model and view roots', () => {
  19. const editor = new VirtualTestEditor( { foo: 1 } );
  20. expect( editor.document.getRoot() ).to.have.property( 'name', '$root' );
  21. expect( editor.editing.view.getRoot() ).to.have.property( 'name', 'div' );
  22. expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
  23. } );
  24. } );
  25. describe( 'create', () => {
  26. it( 'creates an instance of editor', () => {
  27. return VirtualTestEditor.create( { foo: 1 } )
  28. .then( editor => {
  29. expect( editor ).to.be.instanceof( VirtualTestEditor );
  30. expect( editor.config.get( 'foo' ) ).to.equal( 1 );
  31. } );
  32. } );
  33. } );
  34. } );