Skip to content

Commit

Permalink
Fixed include regression. Closes #354
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 30, 2011
1 parent 733dcaf commit c03d8b0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/nodes/literal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ var Node = require('./node');
*/

var Literal = module.exports = function Literal(str) {
this.str = str;
this.str = str
.replace(/\n/g, "\\n")
.replace(/'/g, "\\'");
};

/**
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/scripts.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
script(src='/jquery.js')
script(src='/caustic.js')
3 changes: 3 additions & 0 deletions test/fixtures/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
color: black;
}
23 changes: 23 additions & 0 deletions test/jade.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,29 @@ module.exports = {
assert.equal('<p>awesome tobi</p><p>lame jane</p><p>loki</p>', render(str));
},

'test include': function(assert){
var str = [
'html',
' head',
' include fixtures/test.css',
].join('\n');

assert.equal('<html><head>body {\n color: black;\n}</head></html>'
, render(str, { filename: __dirname + '/jade.test.js' }));
},

'test include block': function(assert){
var str = [
'html',
' head',
' include fixtures/scripts',
' scripts(src="/app.js")',
].join('\n');

assert.equal('<html><head><script src=\"/jquery.js\"></script><script src=\"/caustic.js\"></script><scripts src=\"/app.js\"></scripts></head></html>'
, render(str, { filename: __dirname + '/jade.test.js' }));
},

'test .render(str, fn)': function(assert){
jade.render('p foo bar', function(err, str){
assert.ok(!err);
Expand Down

1 comment on commit c03d8b0

@danmactough
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected. Thanks!

Please sign in to comment.