summaryrefslogtreecommitdiffstats
path: root/packages/kadira-flow-router/test/common/router.addons.spec.js
blob: f5078734174afef1250791e8c45c0c4e1ccb6e68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Router = FlowRouter.Router;

Tinytest.addAsync('Common - Addons - onRouteRegister basic usage', function (test, done) {
  var name = Random.id();
  var customField = Random.id();
  var pathDef = '/' + name;
  
  FlowRouter.onRouteRegister(function(route) {
    test.equal(route, {
      pathDef: pathDef,

      // Route.path is deprecated and will be removed in 3.0
      path: pathDef,

      name: name,
      options: {customField: customField}
    });  
    FlowRouter._onRouteCallbacks = [];
    done();
  });

  FlowRouter.route(pathDef, {
    name: name,
    action: function() {},
    subscriptions: function() {},
    triggersEnter: function() {},
    triggersExit: function() {},
    customField: customField
  });
});