Skip to content

Commit

Permalink
Merge pull request #290 from richsilv/group-names
Browse files Browse the repository at this point in the history
Adds `name` option to groups
  • Loading branch information
arunoda committed Aug 27, 2015
2 parents 3ef49a1 + d28783b commit d504b2b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Group = function(router, options, parent) {

this._router = router;
this.prefix = options.prefix || '';
this.name = options.name;

this._triggersEnter = options.triggersEnter || [];
this._triggersExit = options.triggersExit || [];
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Package.onTest(function(api) {
api.addFiles('test/client/triggers.js', 'client');

api.addFiles('test/server/plugins/fast_render.js', 'server');

api.addFiles('test/common/router.path.spec.js', ['client', 'server']);
api.addFiles('test/common/router.addons.spec.js', ['client', 'server']);
api.addFiles('test/common/route.spec.js', ['client', 'server']);
Expand Down
18 changes: 18 additions & 0 deletions test/client/group.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,21 @@ Tinytest.addAsync('Client - Group - subscribe', function (test, next) {
next();
}, 100);
});


Tinytest.addAsync('Client - Group - set and retrieve group name', function (test, next) {
var rand = Random.id();
var name = Random.id();

var group = FlowRouter.group({
name: name
});

group.route('/' + rand);

FlowRouter.go('/' + rand);
setTimeout(function() {
test.isTrue(FlowRouter.current().route.group.name === name);
next();
}, 100);
});

0 comments on commit d504b2b

Please sign in to comment.