contextplugin.js 959 B

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