8
0

eventinfo.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 EventInfo from '../src/eventinfo';
  6. describe( 'EventInfo', () => {
  7. it( 'should be created properly', () => {
  8. const event = new EventInfo( this, 'test' );
  9. expect( event.source ).to.equal( this );
  10. expect( event.name ).to.equal( 'test' );
  11. expect( event.path ).to.deep.equal( [] );
  12. expect( event.stop.called ).to.not.be.true;
  13. expect( event.off.called ).to.not.be.true;
  14. } );
  15. it( 'should have stop() and off() marked', () => {
  16. const event = new EventInfo( this, 'test' );
  17. event.stop();
  18. event.off();
  19. expect( event.stop.called ).to.be.true;
  20. expect( event.off.called ).to.be.true;
  21. } );
  22. it( 'should not mark "called" in future instances', () => {
  23. let event = new EventInfo( this, 'test' );
  24. event.stop();
  25. event.off();
  26. event = new EventInfo( 'test' );
  27. expect( event.stop.called ).to.not.be.true;
  28. expect( event.off.called ).to.not.be.true;
  29. } );
  30. } );