operation.js 935 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* bender-tags: treemodel, delta */
  6. 'use strict';
  7. import Delta from '/ckeditor5/engine/treemodel/delta/delta.js';
  8. import Operation from '/ckeditor5/engine/treemodel/operation/operation.js';
  9. describe( 'Operation', () => {
  10. it( 'should save its base version', () => {
  11. let op = new Operation( 4 );
  12. expect( op.baseVersion ).to.equal( 4 );
  13. } );
  14. it( 'should be correctly transformed to JSON', () => {
  15. let delta = new Delta();
  16. let opInDelta = new Operation( 0 );
  17. delta.addOperation( opInDelta );
  18. let opOutsideDelta = new Operation( 0 );
  19. let parsedIn = JSON.parse( JSON.stringify( opInDelta ) );
  20. let parsedOutside = JSON.parse( JSON.stringify( opOutsideDelta ) );
  21. expect( parsedIn.delta ).to.equal( '[engine.treeModel.Delta]' );
  22. expect( parsedOutside.delta ).to.be.null;
  23. } );
  24. } );