plugin.js 881 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import Plugin from '../src/plugin';
  6. import Editor from '../src/editor/editor';
  7. let editor;
  8. before( () => {
  9. editor = new Editor();
  10. } );
  11. describe( 'constructor()', () => {
  12. it( 'should set the `editor` property', () => {
  13. const plugin = new Plugin( editor );
  14. expect( plugin ).to.have.property( 'editor' ).to.equal( editor );
  15. } );
  16. describe( 'destroy()', () => {
  17. it( 'should be defined', () => {
  18. const plugin = new Plugin( editor );
  19. expect( plugin.destroy ).to.be.a( 'function' );
  20. } );
  21. it( 'should stop listening', () => {
  22. const plugin = new Plugin( editor );
  23. const stopListeningSpy = sinon.spy( plugin, 'stopListening' );
  24. plugin.destroy();
  25. expect( stopListeningSpy.calledOnce ).to.equal( true );
  26. } );
  27. } );
  28. } );