operationfactory.js 727 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import Document from '../../../src/model/document';
  6. import NoOperation from '../../../src/model/operation/nooperation';
  7. import OperationFactory from '../../../src/model/operation/operationfactory';
  8. describe( 'OperationFactory', () => {
  9. let doc;
  10. beforeEach( () => {
  11. doc = new Document();
  12. } );
  13. it( 'should create operation from JSON', () => {
  14. const operation = OperationFactory.fromJSON( {
  15. __className: 'engine.model.operation.NoOperation',
  16. baseVersion: 0
  17. }, doc );
  18. expect( operation ).to.instanceof( NoOperation );
  19. expect( operation.baseVersion ).to.equal( 0 );
  20. } );
  21. } );