8
0

eventinfo.js 988 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import EventInfo from '/ckeditor5/utils/eventinfo.js';
  6. describe( 'EventInfo', () => {
  7. it( 'should be created properly', () => {
  8. let event = new EventInfo( this, 'test' );
  9. expect( event.source ).to.equal( this );
  10. expect( event.name ).to.equal( 'test' );
  11. expect( event.stop.called ).to.not.be.true;
  12. expect( event.off.called ).to.not.be.true;
  13. } );
  14. it( 'should have stop() and off() marked', () => {
  15. let event = new EventInfo( this, 'test' );
  16. event.stop();
  17. event.off();
  18. expect( event.stop.called ).to.be.true;
  19. expect( event.off.called ).to.be.true;
  20. } );
  21. it( 'should not mark "called" in future instances', () => {
  22. let event = new EventInfo( this, 'test' );
  23. event.stop();
  24. event.off();
  25. event = new EventInfo( 'test' );
  26. expect( event.stop.called ).to.not.be.true;
  27. expect( event.off.called ).to.not.be.true;
  28. } );
  29. } );