Skip to content
Browse files

Added haml test

  • Loading branch information...
1 parent 14280df commit dc5caebbf860c5f77011be3c3aaabd1ac049c61e @tj tj committed
Showing with 20 additions and 0 deletions.
  1. +3 −0 .gitmodules
  2. +1 −0 Makefile
  3. +1 −0 support/haml
  4. +1 −0 test/fixtures/hello.haml
  5. +14 −0 test/view.test.js
View
3 .gitmodules
@@ -7,3 +7,6 @@
[submodule "support/jade"]
path = support/jade
url = git://github.com/visionmedia/jade.git
+[submodule "support/haml"]
+ path = support/haml
+ url = git://github.com/visionmedia/haml.js.git
View
1 Makefile
@@ -30,6 +30,7 @@ test:
@CONNECT_ENV=test ./support/expresso/bin/expresso \
-I lib \
-I support/connect/lib \
+ -I support/haml/lib \
-I support/jade/lib \
test/*.test.js
1 support/haml
@@ -0,0 +1 @@
+Subproject commit 015e921327472a096717176a58842f8c1b845fb7
View
1 test/fixtures/hello.haml
@@ -0,0 +1 @@
+%p Hello World
View
14 test/view.test.js
@@ -9,20 +9,30 @@ module.exports = {
'test #render()': function(assert){
var app = express.createServer();
app.set('views', __dirname + '/fixtures');
+
app.get('/', function(req, res){
res.render('index.jade', { layout: false });
});
+ app.get('/haml', function(req, res){
+ res.render('hello.haml', { layout: false });
+ });
+
assert.response(app,
{ url: '/' },
{ body: '<p>Welcome</p>' });
+ assert.response(app,
+ { url: '/haml' },
+ { body: '\n<p>Hello World</p>' });
},
'test #render() layout': function(assert){
var app = express.createServer();
app.set('views', __dirname + '/fixtures');
+
app.get('/', function(req, res){
res.render('index.jade');
});
+
assert.response(app,
{ url: '/' },
{ body: '<html><body><p>Welcome</p></body></html>' });
@@ -31,9 +41,11 @@ module.exports = {
'test #render() specific layout': function(assert){
var app = express.createServer();
app.set('views', __dirname + '/fixtures');
+
app.get('/', function(req, res){
res.render('index.jade', { layout: 'cool.layout.jade' });
});
+
assert.response(app,
{ url: '/' },
{ body: '<cool><p>Welcome</p></cool>' });
@@ -42,9 +54,11 @@ module.exports = {
'test #partial()': function(assert){
var app = express.createServer();
app.set('views', __dirname + '/fixtures');
+
app.get('/', function(req, res){
res.render('items.jade', { locals: { items: ['one', 'two'] }});
});
+
assert.response(app,
{ url: '/' },
{ body: '<html><body><ul><li>one</li><li>two</li></ul></body></html>' });

0 comments on commit dc5caeb

Please sign in to comment.
Something went wrong with that request. Please try again.