contextplugin.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 ContextPlugin from '../src/contextplugin';
  6. describe( 'ContextPlugin', () => {
  7. const contextMock = {};
  8. it( 'should be marked as a context plugin', () => {
  9. expect( ContextPlugin.isContextPlugin ).to.true;
  10. } );
  11. describe( 'constructor()', () => {
  12. it( 'should set the `context` property', () => {
  13. const plugin = new ContextPlugin( contextMock );
  14. expect( plugin ).to.have.property( 'context' ).to.equal( contextMock );
  15. } );
  16. } );
  17. describe( 'destroy()', () => {
  18. it( 'should be defined', () => {
  19. const plugin = new ContextPlugin( contextMock );
  20. expect( plugin.destroy ).to.be.a( 'function' );
  21. } );
  22. it( 'should stop listening', () => {
  23. const plugin = new ContextPlugin( contextMock );
  24. const stopListeningSpy = sinon.spy( plugin, 'stopListening' );
  25. plugin.destroy();
  26. sinon.assert.calledOnce( stopListeningSpy );
  27. } );
  28. } );
  29. } );