nooperation.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* bender-tags: treemodel, operation */
  6. 'use strict';
  7. import Document from '/ckeditor5/core/treemodel/document.js';
  8. import NoOperation from '/ckeditor5/core/treemodel/operation/nooperation.js';
  9. describe( 'NoOperation', () => {
  10. let noop, doc, root;
  11. beforeEach( () => {
  12. noop = new NoOperation( 0 );
  13. doc = new Document();
  14. root = doc.createRoot( 'root' );
  15. } );
  16. it( 'should not throw an error when applied', () => {
  17. expect( () => doc.applyOperation( noop ) ).to.not.throw( Error );
  18. } );
  19. it( 'should create a NoOperation as a reverse', () => {
  20. const reverse = noop.getReversed();
  21. expect( reverse ).to.be.an.instanceof( NoOperation );
  22. expect( reverse.baseVersion ).to.equal( 1 );
  23. } );
  24. it( 'should create a do-nothing operation having same parameters when cloned', () => {
  25. const clone = noop.clone();
  26. expect( clone ).to.be.an.instanceof( NoOperation );
  27. expect( clone.baseVersion ).to.equal( 0 );
  28. } );
  29. } );