Skip to content

Commit

Permalink
Added haml test
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jul 7, 2010
1 parent 14280df commit dc5caeb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -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
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions support/haml
Submodule haml added at 015e92
1 change: 1 addition & 0 deletions test/fixtures/hello.haml
@@ -0,0 +1 @@
%p Hello World
14 changes: 14 additions & 0 deletions test/view.test.js
Expand Up @@ -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>' });
Expand All @@ -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>' });
Expand All @@ -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>' });
Expand Down

0 comments on commit dc5caeb

Please sign in to comment.