plugin.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * @license Copyright (c) 2003-2020, 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. it( 'should not be marked as a context plugin', () => {
  13. expect( Plugin.isContextPlugin ).to.false;
  14. } );
  15. describe( 'constructor()', () => {
  16. it( 'should set the `editor` property', () => {
  17. const plugin = new Plugin( editor );
  18. expect( plugin ).to.have.property( 'editor' ).to.equal( editor );
  19. } );
  20. } );
  21. describe( 'destroy()', () => {
  22. it( 'should be defined', () => {
  23. const plugin = new Plugin( editor );
  24. expect( plugin.destroy ).to.be.a( 'function' );
  25. } );
  26. it( 'should stop listening', () => {
  27. const plugin = new Plugin( editor );
  28. const stopListeningSpy = sinon.spy( plugin, 'stopListening' );
  29. plugin.destroy();
  30. expect( stopListeningSpy.calledOnce ).to.equal( true );
  31. } );
  32. } );
  33. } );