8
0

spy.js 570 B

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