forked from assemble/assemble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.onLoad.js
50 lines (40 loc) · 1.17 KB
/
app.onLoad.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
'use strict';
require('mocha');
require('should');
var assert = require('assert');
var support = require('./support');
var App = support.resolve();
var app;
describe('app.onLoad', function() {
beforeEach(function() {
app = new App();
});
describe('app.collection', function() {
it('should emit an onLoad when view is created', function(cb) {
var collection = app.collection();
app.on('onLoad', function(view) {
assert(view.path === 'blog/foo.js');
cb();
});
app.onLoad('blog/:title', function(view, next) {
assert(view.path === 'blog/foo.js');
next();
});
collection.addView('whatever', {path: 'blog/foo.js', content: 'bar baz'});
});
});
describe('view collections', function() {
it('should emit an onLoad when view is created', function(cb) {
app.create('posts');
app.on('onLoad', function(view) {
assert(view.path === 'blog/foo.js');
cb();
});
app.onLoad('blog/:title', function(view, next) {
assert(view.path === 'blog/foo.js');
next();
});
app.post('whatever', {path: 'blog/foo.js', content: 'bar baz'});
});
});
});