eventinfo.js 1.1 KB

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