Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from JacksonTian/fix_tag_setting
Fix #5, when ejs refererences is differences, setting tag will fails
- Loading branch information
Showing
4 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*! | ||
* connect-render - test/render_tag.test.js | ||
* Copyright(c) 2013 JacksonTian <shyvo1987@gmail.com> | ||
* MIT Licensed | ||
*/ | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var path = require('path'); | ||
var fs = require('fs'); | ||
var connect = require('connect'); | ||
var request = require('supertest'); | ||
var render = require('../lib/render'); | ||
var should = require('should'); | ||
|
||
var options = { | ||
root: path.join(__dirname, 'views'), | ||
layout: false, | ||
open: '{{', | ||
close: '}}', | ||
cache: true // `false` for debug | ||
}; | ||
|
||
var app = connect(render(options)); | ||
|
||
app.use(function (req, res) { | ||
if (req.url === '/mustache') { | ||
return res.render('mustache.html', { name: 'fengmk2' }); | ||
} | ||
|
||
res.render('index.html', { name: 'fengmk2' }); | ||
}); | ||
|
||
app.use(function (err, req, res, next) { | ||
console.log(err.stack); | ||
next(err); | ||
}); | ||
|
||
describe('render', function () { | ||
describe('tag open/close', function () { | ||
it('should ok with {{}}', function (done) { | ||
request(app).get('/mustache') | ||
.expect(200) | ||
.expect('Hello, I am fengmk2.\n', done); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello, I am {{=name}}. |