8
0

eventinfo.js 1.1 KB

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