eventinfo.js 1014 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import EventInfo from '/ckeditor5/core/eventinfo.js';
  7. describe( 'EventInfo', () => {
  8. it( 'should be created properly', () => {
  9. let event = new EventInfo( this, 'test' );
  10. expect( event.source ).to.equal( this );
  11. expect( event.name ).to.equal( 'test' );
  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. let 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. } );