eventinfo.js 1.2 KB

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