createdocumentmock.js 791 B

1234567891011121314151617181920212223
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
  6. import DocumentSelection from '../../../src/view/documentselection';
  7. import { StylesProcessor } from '../../../src/view/stylesmap';
  8. /**
  9. * Creates {@link module:engine/view/document~Document view Document} mock.
  10. *
  11. * @returns {utils.ObservableMixin} Document mock
  12. */
  13. export default function createDocumentMock() {
  14. const doc = Object.create( ObservableMixin );
  15. doc.set( 'isFocused', false );
  16. doc.set( 'isReadOnly', false );
  17. doc.selection = new DocumentSelection();
  18. doc.stylesProcessor = new StylesProcessor();
  19. return doc;
  20. }