virtualtesteditor.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import StandardEditor from '/ckeditor5/editor/standardeditor.js';
  6. import VirtualTestEditor from '/tests/ckeditor5/_utils/virtualtesteditor.js';
  7. import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
  8. import testUtils from '/tests/ckeditor5/_utils/utils.js';
  9. testUtils.createSinonSandbox();
  10. describe( 'VirtualTestEditor', () => {
  11. describe( 'constructor', () => {
  12. it( 'creates an instance of editor', () => {
  13. const editor = new VirtualTestEditor( { foo: 1 } );
  14. expect( editor ).to.be.instanceof( StandardEditor );
  15. expect( editor.config.get( 'foo' ) ).to.equal( 1 );
  16. } );
  17. it( 'creates model and view roots', () => {
  18. const editor = new VirtualTestEditor( { foo: 1 } );
  19. expect( editor.document.getRoot() ).to.have.property( 'name', '$root' );
  20. expect( editor.editing.view.getRoot() ).to.have.property( 'name', 'div' );
  21. expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
  22. } );
  23. } );
  24. describe( 'create', () => {
  25. it( 'creates an instance of editor', () => {
  26. return VirtualTestEditor.create( { foo: 1 } )
  27. .then( editor => {
  28. expect( editor ).to.be.instanceof( VirtualTestEditor );
  29. expect( editor.config.get( 'foo' ) ).to.equal( 1 );
  30. } );
  31. } );
  32. } );
  33. } );