router.addons.spec.js 730 B

123456789101112131415161718192021222324252627282930
  1. Router = FlowRouter.Router;
  2. Tinytest.addAsync('Common - Addons - onRouteRegister basic usage', function (test, done) {
  3. var name = Random.id();
  4. var customField = Random.id();
  5. var pathDef = '/' + name;
  6. FlowRouter.onRouteRegister(function(route) {
  7. test.equal(route, {
  8. pathDef: pathDef,
  9. // Route.path is deprecated and will be removed in 3.0
  10. path: pathDef,
  11. name: name,
  12. options: {customField: customField}
  13. });
  14. FlowRouter._onRouteCallbacks = [];
  15. done();
  16. });
  17. FlowRouter.route(pathDef, {
  18. name: name,
  19. action: function() {},
  20. subscriptions: function() {},
  21. triggersEnter: function() {},
  22. triggersExit: function() {},
  23. customField: customField
  24. });
  25. });