1 | (function() {
|
2 | var Assemble, Handlebars, _log;
|
3 |
|
4 | require('should');
|
5 |
|
6 | Handlebars = require('handlebars');
|
7 |
|
8 | Assemble = require('../lib/helpers-lib');
|
9 |
|
10 | _log = console ? console.log : function() {};
|
11 |
|
12 | _log.history = [];
|
13 |
|
14 | console.log = function() {
|
15 | _log.history.push.apply(_log.history, arguments);
|
16 | return _log.apply(console, arguments);
|
17 | };
|
18 |
|
19 | describe('log', function() {
|
20 | return describe('{{log "Hi console :)"}}', function() {
|
21 | return it('should log a message to the console.', function() {
|
22 | var source, template;
|
23 |
|
24 | source = '{{log "Hi console :)"}}';
|
25 | template = Handlebars.compile(source);
|
26 | template();
|
27 | return _log.history.should.include('Hi console :)');
|
28 | });
|
29 | });
|
30 | });
|
31 |
|
32 | _log.history = [];
|
33 |
|
34 | describe('debug', function() {
|
35 | return describe('{{debug value}}', function() {
|
36 | return it('should log current context.', function() {
|
37 | var context, source, template;
|
38 |
|
39 | source = '{{debug this}}';
|
40 | template = Handlebars.compile(source);
|
41 | context = 'elving';
|
42 | template(context);
|
43 | return _log.history.should.include('elving');
|
44 | });
|
45 | });
|
46 | });
|
47 |
|
48 | }).call(this);
|