-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgroup.js
72 lines (61 loc) · 1.54 KB
/
group.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { Meteor } from 'meteor/meteor';
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
if (Meteor.isServer) {
return;
}
const group = FlowRouter.group({
prefix: '/group',
title: 'GROUP TITLE',
titlePrefix: 'Group > '
});
group.route('/groupPage1', {
name: 'groupPage1',
action() {}
});
group.route('/groupPage2', {
name: 'groupPage2',
title: 'Group page 2',
action() {}
});
const nestedGroup = group.group({
prefix: '/level2',
title: 'LEVEL2 GROUP TITLE',
titlePrefix: 'Group Level 2 > '
});
nestedGroup.route('/withoutTitle', {
name: 'lvl2',
action() {}
});
nestedGroup.route('/witTitle', {
name: 'lvl2Title',
title: 'Level 2 page',
action() {}
});
Tinytest.addAsync('Group - level 1 - no route title', function (test, next) {
FlowRouter.go('groupPage1');
setTimeout(() => {
test.equal(document.title, 'GROUP TITLE');
next();
}, 100);
});
Tinytest.addAsync('Group - level 1 - with route title', function (test, next) {
FlowRouter.go('groupPage2');
setTimeout(() => {
test.equal(document.title, 'Group > Group page 2');
next();
}, 100);
});
Tinytest.addAsync('Group - level 2 - no route title', function (test, next) {
FlowRouter.go('lvl2');
setTimeout(() => {
test.equal(document.title, 'Group > LEVEL2 GROUP TITLE');
next();
}, 100);
});
Tinytest.addAsync('Group - level 2 - with route title', function (test, next) {
FlowRouter.go('lvl2Title');
setTimeout(() => {
test.equal(document.title, 'Group > Group Level 2 > Level 2 page');
next();
}, 100);
});