8
0

plugin.js 990 B

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