all-off.js 736 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. var ee = require('../');
  3. module.exports = function (t, a) {
  4. var x, count, count2;
  5. x = ee();
  6. count = 0;
  7. count2 = 0;
  8. x.on('foo', function () {
  9. ++count;
  10. });
  11. x.on('foo', function () {
  12. ++count;
  13. });
  14. x.on('bar', function () {
  15. ++count2;
  16. });
  17. x.on('bar', function () {
  18. ++count2;
  19. });
  20. t(x, 'foo');
  21. x.emit('foo');
  22. x.emit('bar');
  23. a(count, 0, "All off: type");
  24. a(count2, 2, "All off: ohter type");
  25. count = 0;
  26. count2 = 0;
  27. x.on('foo', function () {
  28. ++count;
  29. });
  30. x.on('foo', function () {
  31. ++count;
  32. });
  33. x.on('bar', function () {
  34. ++count2;
  35. });
  36. x.on('bar', function () {
  37. ++count2;
  38. });
  39. t(x);
  40. x.emit('foo');
  41. x.emit('bar');
  42. a(count, 0, "All off: type");
  43. a(count2, 0, "All off: other type");
  44. };