1 | var t = require('../test-lib/test.js');
|
2 | var assert = require('assert');
|
3 | var apos;
|
4 |
|
5 | describe('Admin bar', function() {
|
6 |
|
7 | this.timeout(t.timeout);
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | it('should allow a group reversing the current order', function(done) {
|
14 | this.timeout(10000);
|
15 | apos = require('../index.js')({
|
16 | root: module,
|
17 | shortName: 'test',
|
18 |
|
19 | modules: {
|
20 | 'apostrophe-express': {
|
21 | secret: 'xxx',
|
22 | port: 7900,
|
23 | csrf: false
|
24 | },
|
25 | 'apostrophe-admin-bar': {
|
26 | addGroups: [
|
27 | {
|
28 | label: 'Media',
|
29 | items: [
|
30 | 'apostrophe-images',
|
31 | 'apostrophe-files'
|
32 | ]
|
33 | },
|
34 | {
|
35 | label: 'Content',
|
36 | items: [
|
37 | 'apostrophe-login-logout',
|
38 | 'apostrophe-files',
|
39 | 'apostrophe-images'
|
40 | ]
|
41 | }
|
42 | ]
|
43 | }
|
44 | },
|
45 | afterInit: function(callback) {
|
46 | assert(apos.modules['apostrophe-admin-bar']);
|
47 | assert(apos.adminBar);
|
48 | assert(apos.adminBar.items.length === 8);
|
49 | assert(apos.adminBar.items[5].name === 'apostrophe-login-logout');
|
50 | assert(apos.adminBar.items[6].name === 'apostrophe-files');
|
51 | assert(apos.adminBar.items[7].name === 'apostrophe-images');
|
52 |
|
53 |
|
54 |
|
55 | apos.argv._ = [];
|
56 | return callback(null);
|
57 | },
|
58 | afterListen: function(err) {
|
59 | assert(!err);
|
60 | return t.destroy(apos, done);
|
61 | }
|
62 | });
|
63 | });
|
64 |
|
65 | it('should allow a group obeying the current order', function(done) {
|
66 | this.timeout(10000);
|
67 | apos = require('../index.js')({
|
68 | root: module,
|
69 | shortName: 'test',
|
70 |
|
71 | modules: {
|
72 | 'apostrophe-express': {
|
73 | secret: 'xxx',
|
74 | port: 7900,
|
75 | csrf: false
|
76 | },
|
77 | 'apostrophe-admin-bar': {
|
78 | addGroups: [
|
79 | {
|
80 | label: 'Media',
|
81 | items: [
|
82 | 'apostrophe-images',
|
83 | 'apostrophe-files'
|
84 | ]
|
85 | },
|
86 | {
|
87 | label: 'Content',
|
88 | items: [
|
89 | 'apostrophe-files',
|
90 | 'apostrophe-images',
|
91 | 'apostrophe-login-logout'
|
92 | ]
|
93 | }
|
94 | ]
|
95 | }
|
96 | },
|
97 | afterInit: function(callback) {
|
98 | assert(apos.modules['apostrophe-admin-bar']);
|
99 | assert(apos.adminBar);
|
100 | assert(apos.adminBar.items.length === 8);
|
101 | assert(apos.adminBar.items[5].name === 'apostrophe-files');
|
102 | assert(apos.adminBar.items[6].name === 'apostrophe-images');
|
103 | assert(apos.adminBar.items[7].name === 'apostrophe-login-logout');
|
104 |
|
105 |
|
106 |
|
107 | apos.argv._ = [];
|
108 | return callback(null);
|
109 | },
|
110 | afterListen: function(err) {
|
111 | assert(!err);
|
112 | return t.destroy(apos, done);
|
113 | }
|
114 | });
|
115 | });
|
116 |
|
117 | });
|