spy.js 518 B

12345678910111213141516171819202122
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. /**
  7. * Creates a spy function (ala Sinon.js) that can be used to inspect call to it.
  8. *
  9. * The following are the present features:
  10. *
  11. * * spy.called: property set to `true` if the function has been called at least once.
  12. *
  13. * @memberOf utils
  14. * @returns {Function} The spy function.
  15. */
  16. export default function spy() {
  17. return function spy() {
  18. spy.called = true;
  19. };
  20. }