utils.js 877 B

1234567891011121314151617181920212223242526272829303132333435363738
  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( 'utils' );
  8. describe( 'spy', function() {
  9. it( 'should register calls', function() {
  10. var utils = modules.utils;
  11. var fn1 = utils.spy();
  12. var fn2 = utils.spy();
  13. fn1();
  14. expect( fn1.called ).to.be.true();
  15. expect( fn2.called ).to.not.be.true();
  16. } );
  17. } );
  18. describe( 'uid', function() {
  19. it( 'should return different ids', function() {
  20. var utils = modules.utils;
  21. var id1 = utils.uid();
  22. var id2 = utils.uid();
  23. var id3 = utils.uid();
  24. expect( id1 ).to.be.a( 'number' );
  25. expect( id2 ).to.be.a( 'number' ).to.not.equal( id1 ).to.not.equal( id3 );
  26. expect( id3 ).to.be.a( 'number' ).to.not.equal( id1 ).to.not.equal( id2 );
  27. } );
  28. } );