Skip to content
Myr

Merge branch 'flipViewExt' of git://github.com/aheckmann/express into flip-views

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parents d31de1e, 73d2603 · Browse files · 47 files+362 added−364 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

47 files+362 added−364 removed

  • tests:+36 added−36 removed
  • other:+326 added−328 removed

47 files+362 added−364 removed

deleted:examples/chat/views/partials/message.haml.html-1 removed
added:examples/chat/views/partials/message.html.haml+1 added
1%li= message
deleted:examples/chat/views/chat.haml.html-9 removed
added:examples/chat/views/chat.html.haml+9 added
1%h1 Chat2%img.bubble{ src: '/public/images/bubble.png' }3%ul#messages4 = this.partial('message.haml.html', { collection: messages })5%form{ method: 'post' }6 %input{ type: 'hidden', name: '_method', value: 'put' }7 %input{ type: 'text', name: 'name', value: name || 'guest' }8 %input{ type: 'text', name: 'message' }9 %input{ type: 'submit', value: 'Send' }
deleted:examples/chat/views/layout.haml.html-11 removed
added:examples/chat/views/layout.html.haml+11 added
1%html2 %head3 %title= title4 %script{ src: '/public/javascripts/jquery.js' }5 %script{ src: '/public/javascripts/app.js' }6 %link{ rel: 'stylesheet', href: '/style.css' }7 %body8 #wrapper= body9 #online 10 Online:11 %strong= usersOnline
added:examples/chat/views/style.css.sass+81 added
1body2 :font-family "Helvetica Neue", "Lucida Grande", "Arial"3 :font-size 13px4 :text-align center5 =text-stroke 1px rgba(255, 255, 255, 0.1)6 :color #5557 8h1, h29 :margin 010 :font-size 22px11 :color #34343412h113 :text-shadow 1px 2px 2px #ddd14 :font-size 60px15 16img.bubble17 :position absolute18 :top -25px19 :left 120px20 21#wrapper22 :position relative23 :margin 100px auto24 :width 500px25 :text-align left26 27ul28 :margin 029 :padding 030 :max-height 300px31 :overflow-x hidden32 li33 :margin 5px 034 :padding 3px 8px35 :list-style none36 :border 1px solid #eee37 =border-radius 3px38 =border-radius 3px39 li:hover40 :cursor pointer41 :color #2E2E2E4243input[type=text]44 :padding 5px45 :border 1px solid #ddd46 :outline none47 =border-radius 2px48input[type=text]:focus49 :border-color #00C3FF5051input[type=submit]52 =border-radius 2px53 =box-shadow 0 1px 2px #ddd54 :padding 6px 10px55 :border solid 1px #99956 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))57 :color #33358 :text-decoration none59 :cursor pointer60 :display inline-block61 :text-align center62 :text-shadow 0px 1px 1px #fff63 :line-height 164input[type=submit]:hover65 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))66input[type=submit]:active67 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))68input[name=name]69 :width 80px70 71a72 :color #1ABFF173 =transition-property padding74 =transition-duration 0.15s75a:hover76 :padding 0 5px77a:hover:before78 :content 'visit: '79 80#online81 :font-size 12px
deleted:examples/chat/views/style.sass.css-81 removed
1body2 :font-family "Helvetica Neue", "Lucida Grande", "Arial"3 :font-size 13px4 :text-align center5 =text-stroke 1px rgba(255, 255, 255, 0.1)6 :color #5557 8h1, h29 :margin 010 :font-size 22px11 :color #34343412h113 :text-shadow 1px 2px 2px #ddd14 :font-size 60px15 16img.bubble17 :position absolute18 :top -25px19 :left 120px20 21#wrapper22 :position relative23 :margin 100px auto24 :width 500px25 :text-align left26 27ul28 :margin 029 :padding 030 :max-height 300px31 :overflow-x hidden32 li33 :margin 5px 034 :padding 3px 8px35 :list-style none36 :border 1px solid #eee37 =border-radius 3px38 =border-radius 3px39 li:hover40 :cursor pointer41 :color #2E2E2E4243input[type=text]44 :padding 5px45 :border 1px solid #ddd46 :outline none47 =border-radius 2px48input[type=text]:focus49 :border-color #00C3FF5051input[type=submit]52 =border-radius 2px53 =box-shadow 0 1px 2px #ddd54 :padding 6px 10px55 :border solid 1px #99956 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))57 :color #33358 :text-decoration none59 :cursor pointer60 :display inline-block61 :text-align center62 :text-shadow 0px 1px 1px #fff63 :line-height 164input[type=submit]:hover65 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))66input[type=submit]:active67 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))68input[name=name]69 :width 80px70 71a72 :color #1ABFF173 =transition-property padding74 =transition-duration 0.15s75a:hover76 :padding 0 5px77a:hover:before78 :content 'visit: '79 80#online81 :font-size 12px
modified:examples/chat/app.js+2 added-2 removed
deleted:examples/coffee-upload/views/layout.haml.html-14 removed
added:examples/coffee-upload/views/layout.html.haml+14 added
1%html2 %head3 %title Upload4 %script{ src: '/public/javascripts/jquery.js' }5 %script{ src: '/public/javascripts/app.js' }6 %link{ rel: 'stylesheet', href: '/style.css' }7 %body8 #wrapper9 %h1 Upload10 :if flashes11 %ul.messages.info12 :each msg in flashes13 %li= msg14 .body= body
added:examples/coffee-upload/views/style.css.sass+68 added
1body2 :font-family "Helvetica Neue", "Lucida Grande", "Arial"3 :font-size 13px4 :text-align center5 :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6 :color #5557 8h1, h29 :margin 0 0 15px 010 :font-size 22px11 :color #34343412h113 :text-shadow 1px 2px 2px #ddd14 :font-size 60px15h216 :margin-top 15px17 18#wrapper19 :position relative20 :margin 100px auto21 :width 500px22 :text-align left2324input[type=file]25 :padding 5px26 :border 1px solid #ddd27 :outline none28 :-webkit-border-radius 2px29 :-moz-border-radius 2px30input[type=file]:focus31 :border-color #00C3FF3233input[type=submit]34 :-webkit-border-radius 2px35 :-moz-border-radius 2px36 :-webkit-box-shadow 0 1px 2px #ddd37 :-moz-box-shadow 0 1px 2px #ddd38 :padding 6px 10px39 :border solid 1px #99940 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41 :color #33342 :text-decoration none43 :cursor pointer44 :display inline-block45 :text-align center46 :text-shadow 0px 1px 1px #fff47 :line-height 148input[type=submit]:hover49 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50input[type=submit]:active51 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52input[name=name]53 :width 80px54 55form56 .panel57 :float left58 :width 100%59 :margin-bottom 15px60 61.messages62 :margin 063 :padding 064 :border 1px solid #eee65 =box-shadow 2px 2px 5px #eee66 li67 :padding 5px 10px68 :list-style none
deleted:examples/coffee-upload/views/style.sass.css-68 removed
1body2 :font-family "Helvetica Neue", "Lucida Grande", "Arial"3 :font-size 13px4 :text-align center5 :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6 :color #5557 8h1, h29 :margin 0 0 15px 010 :font-size 22px11 :color #34343412h113 :text-shadow 1px 2px 2px #ddd14 :font-size 60px15h216 :margin-top 15px17 18#wrapper19 :position relative20 :margin 100px auto21 :width 500px22 :text-align left2324input[type=file]25 :padding 5px26 :border 1px solid #ddd27 :outline none28 :-webkit-border-radius 2px29 :-moz-border-radius 2px30input[type=file]:focus31 :border-color #00C3FF3233input[type=submit]34 :-webkit-border-radius 2px35 :-moz-border-radius 2px36 :-webkit-box-shadow 0 1px 2px #ddd37 :-moz-box-shadow 0 1px 2px #ddd38 :padding 6px 10px39 :border solid 1px #99940 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41 :color #33342 :text-decoration none43 :cursor pointer44 :display inline-block45 :text-align center46 :text-shadow 0px 1px 1px #fff47 :line-height 148input[type=submit]:hover49 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50input[type=submit]:active51 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52input[name=name]53 :width 80px54 55form56 .panel57 :float left58 :width 100%59 :margin-bottom 15px60 61.messages62 :margin 063 :padding 064 :border 1px solid #eee65 =box-shadow 2px 2px 5px #eee66 li67 :padding 5px 10px68 :list-style none
deleted:examples/coffee-upload/views/upload.haml.html-18 removed
1:if typeof images !== 'undefined'2 .images3 :each img in images4 %img{ src: img }56%h2 Singles7%form{ method: 'post', enctype: 'multipart/form-data' }8 %input{ type: 'file', name: 'images[0]' }9 %input{ type: 'file', name: 'images[1]' }10 %input{ type: 'file', name: 'images[2]' }11 .panel12 %input{ type: 'submit', value: 'Upload' }13 14%h2 Multiple15%form{ method: 'post', enctype: 'multipart/form-data' }16 %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17 .panel18 %input{ type: 'submit', value: 'Upload' }
added:examples/coffee-upload/views/upload.html.haml+18 added
1:if typeof images !== 'undefined'2 .images3 :each img in images4 %img{ src: img }56%h2 Singles7%form{ method: 'post', enctype: 'multipart/form-data' }8 %input{ type: 'file', name: 'images[0]' }9 %input{ type: 'file', name: 'images[1]' }10 %input{ type: 'file', name: 'images[2]' }11 .panel12 %input{ type: 'submit', value: 'Upload' }13 14%h2 Multiple15%form{ method: 'post', enctype: 'multipart/form-data' }16 %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17 .panel18 %input{ type: 'submit', value: 'Upload' }
modified:examples/coffee-upload/app.coffee+2 added-2 removed
15 unmodified lines
16get '/', ->17 @redirect('/upload')1819get '/upload', ->20 @render 'upload.haml.html', {20 @render 'upload.html.haml', {21 locals: {22 flashes: @flash 'info'23 }24 }
4 unmodified lines
29 @flash 'info', 'Uploaded ' + image.filename30 @redirect '/upload'3132get '/*.css', (file) ->33 @render file + '.sass.css', { layout: no }33 @render file + '.css.sass', { layout: no }3435run()
deleted:examples/upload/views/layout.haml.html-14 removed
1%html2 %head3 %title Upload4 %script{ src: '/public/javascripts/jquery.js' }5 %script{ src: '/public/javascripts/app.js' }6 %link{ rel: 'stylesheet', href: '/style.css' }7 %body8 #wrapper9 %h1 Upload10 :if flashes11 %ul.messages.info12 :each msg in flashes13 %li= msg14 .body= body
added:examples/upload/views/layout.html.haml+14 added
1%html2 %head3 %title Upload4 %script{ src: '/public/javascripts/jquery.js' }5 %script{ src: '/public/javascripts/app.js' }6 %link{ rel: 'stylesheet', href: '/style.css' }7 %body8 #wrapper9 %h1 Upload10 :if flashes11 %ul.messages.info12 :each msg in flashes13 %li= msg14 .body= body
added:examples/upload/views/style.css.sass+68 added
1body2 :font-family "Helvetica Neue", "Lucida Grande", "Arial"3 :font-size 13px4 :text-align center5 :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6 :color #5557 8h1, h29 :margin 0 0 15px 010 :font-size 22px11 :color #34343412h113 :text-shadow 1px 2px 2px #ddd14 :font-size 60px15h216 :margin-top 15px17 18#wrapper19 :position relative20 :margin 100px auto21 :width 500px22 :text-align left2324input[type=file]25 :padding 5px26 :border 1px solid #ddd27 :outline none28 :-webkit-border-radius 2px29 :-moz-border-radius 2px30input[type=file]:focus31 :border-color #00C3FF3233input[type=submit]34 :-webkit-border-radius 2px35 :-moz-border-radius 2px36 :-webkit-box-shadow 0 1px 2px #ddd37 :-moz-box-shadow 0 1px 2px #ddd38 :padding 6px 10px39 :border solid 1px #99940 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41 :color #33342 :text-decoration none43 :cursor pointer44 :display inline-block45 :text-align center46 :text-shadow 0px 1px 1px #fff47 :line-height 148input[type=submit]:hover49 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50input[type=submit]:active51 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52input[name=name]53 :width 80px54 55form56 .panel57 :float left58 :width 100%59 :margin-bottom 15px60 61.messages62 :margin 063 :padding 064 :border 1px solid #eee65 =box-shadow 2px 2px 5px #eee66 li67 :padding 5px 10px68 :list-style none
deleted:examples/upload/views/style.sass.css-68 removed
1body2 :font-family "Helvetica Neue", "Lucida Grande", "Arial"3 :font-size 13px4 :text-align center5 :-webkit-text-stroke 1px rgba(255, 255, 255, 0.1)6 :color #5557 8h1, h29 :margin 0 0 15px 010 :font-size 22px11 :color #34343412h113 :text-shadow 1px 2px 2px #ddd14 :font-size 60px15h216 :margin-top 15px17 18#wrapper19 :position relative20 :margin 100px auto21 :width 500px22 :text-align left2324input[type=file]25 :padding 5px26 :border 1px solid #ddd27 :outline none28 :-webkit-border-radius 2px29 :-moz-border-radius 2px30input[type=file]:focus31 :border-color #00C3FF3233input[type=submit]34 :-webkit-border-radius 2px35 :-moz-border-radius 2px36 :-webkit-box-shadow 0 1px 2px #ddd37 :-moz-box-shadow 0 1px 2px #ddd38 :padding 6px 10px39 :border solid 1px #99940 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ddd))41 :color #33342 :text-decoration none43 :cursor pointer44 :display inline-block45 :text-align center46 :text-shadow 0px 1px 1px #fff47 :line-height 148input[type=submit]:hover49 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#E6E4E4))50input[type=submit]:active51 :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#c7c7c7))52input[name=name]53 :width 80px54 55form56 .panel57 :float left58 :width 100%59 :margin-bottom 15px60 61.messages62 :margin 063 :padding 064 :border 1px solid #eee65 =box-shadow 2px 2px 5px #eee66 li67 :padding 5px 10px68 :list-style none
deleted:examples/upload/views/upload.haml.html-18 removed
1:if typeof images !== 'undefined'2 .images3 :each img in images4 %img{ src: img }56%h2 Singles7%form{ method: 'post', enctype: 'multipart/form-data' }8 %input{ type: 'file', name: 'images[0]' }9 %input{ type: 'file', name: 'images[1]' }10 %input{ type: 'file', name: 'images[2]' }11 .panel12 %input{ type: 'submit', value: 'Upload' }13 14%h2 Multiple15%form{ method: 'post', enctype: 'multipart/form-data' }16 %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17 .panel18 %input{ type: 'submit', value: 'Upload' }
added:examples/upload/views/upload.html.haml+18 added
1:if typeof images !== 'undefined'2 .images3 :each img in images4 %img{ src: img }56%h2 Singles7%form{ method: 'post', enctype: 'multipart/form-data' }8 %input{ type: 'file', name: 'images[0]' }9 %input{ type: 'file', name: 'images[1]' }10 %input{ type: 'file', name: 'images[2]' }11 .panel12 %input{ type: 'submit', value: 'Upload' }13 14%h2 Multiple15%form{ method: 'post', enctype: 'multipart/form-data' }16 %input{ type: 'file', name: 'images[]', multiple: 'multiple' }17 .panel18 %input{ type: 'submit', value: 'Upload' }
modified:examples/upload/app.js+2 added-2 removed
18 unmodified lines
19 this.redirect('/upload')20})2122get('/upload', function(){23 this.render('upload.haml.html', {23 this.render('upload.html.haml', {24 locals: {25 flashes: this.flash('info')26 } 27 })
7 unmodified lines
35 this.redirect('/upload')36})3738get('/*.css', function(file){39 this.render(file + '.sass.css', { layout: false })39 this.render(file + '.css.sass', { layout: false })40})4142run()
modified:lib/express/plugins/view.js+18 added-20 removed
133 unmodified lines
134 * @api public135 */136137 render: function(view, options, callback) {138 var self = this,139 options = options || {},138 var options = options || {},139 type = options.partial ? 'partials' : 'views',140 path = set(type) + '/' + view,142 engine = path.split('.').slice(-2)[0],143 ext = extname(path),141 parts = view.split('.'),142 engine = parts.last,143 contentType = parts.slice(-2)[0],144 layout = options.layout === undefined ? 'layout' : options.layout145 content = cache[type][path] || fs.readFileSync(path)146 options.context = options.context || this146 if (type === 'views') self.contentType(ext)147 function render(content) {148 content = (engines[engine] = engines[engine] || require(engine)).render(content, options)149 if (layout)150 self.render(layout + '.' + engine + ext, options.mergeDeep({151 layout: false,152 locals: { body: content }153 }), callback)154 else if (type === 'partials')155 return content156 else if (callback)157 callback.call(self, null, content)158 else159 self.halt(200, content)147 content = (engines[engine] = engines[engine] || require(engine)).render(content, options)148 if (type === 'views') this.contentType(contentType)149 if (layout)150 this.render([layout, contentType, engine].join('.'), options.mergeDeep({151 layout: false,152 locals: { body: content }153 }), callback)154 else if (type === 'partials')155 return content156 else if (callback)157 callback.call(this, null, content)158 else159 this.halt(200, content)160 }161 return render(cache[type][path] || fs.readFileSync(path))160 }161 })162 }163 }
2 unmodified lines
deleted:spec/fixtures/partials/article.haml.html-6 removed
1:if __isFirst__2 %li.first= article3:if __isLast__4 %li.last= article5:if !__isLast__ && !__isFirst__6 %li{ class: __index__ }= article
added:spec/fixtures/partials/article.html.haml+6 added
1:if __isFirst__2 %li.first= article3:if __isLast__4 %li.last= article5:if !__isLast__ && !__isFirst__6 %li{ class: __index__ }= article
deleted:spec/fixtures/partials/item.haml.html-1 removed
1%li= item
added:spec/fixtures/partials/item.html.haml+1 added
1%li= item
deleted:spec/fixtures/partials/video.haml.html-1 removed
1%li= vid
added:spec/fixtures/partials/video.html.haml+1 added
1%li= vid
deleted:spec/fixtures/article.haml.html-1 removed
1%h2= this.name
added:spec/fixtures/article.html.haml+1 added
1%h2= this.name
deleted:spec/fixtures/hello.haml.html-1 removed
1%h2 Hello
added:spec/fixtures/hello.html.haml+1 added
1%h2 Hello
deleted:spec/fixtures/layout.haml.html-2 removed
1%html2 %body= body
added:spec/fixtures/layout.html.haml+2 added
1%html2 %body= body
deleted:spec/fixtures/layout.user.haml.html-2 removed
1%title= "Viewing " + name2%body= body
added:spec/fixtures/layout.user.html.haml+2 added
1%title= "Viewing " + name2%body= body
deleted:spec/fixtures/list.haml.html-3 removed
1%ul2 :each item in items3 = this.partial('item.haml.html', { locals: { item: item }})
added:spec/fixtures/list.html.haml+3 added
1%ul2 :each item in items3 = this.partial('item.html.haml', { locals: { item: item }})
deleted:spec/fixtures/page.haml.html-2 removed
1%title= this.title2%body= body
added:spec/fixtures/page.html.haml+2 added
1%title= this.title2%body= body
deleted:spec/fixtures/user.haml.html-2 removed
1%h1= name2%p= email
added:spec/fixtures/user.html.haml+2 added
1%h1= name2%p= email
added:spec/fixtures/user.html.invalid
deleted:spec/fixtures/user.invalid.html
modified:spec/spec.plugins.view.js+15 added-15 removed
28 unmodified lines
29 30 describe 'given a valid view name'31 it 'should render a partial'32 get('/', function(){33 this.render('list.haml.html', { locals: { items: ['foo', 'bar'] }})33 this.render('list.html.haml', { locals: { items: ['foo', 'bar'] }})34 })35 get('/').body.should.include '<ul>'36 get('/').body.should.include '<li>foo'37 get('/').body.should.include '<li>bar'38 end39 40 it 'should render collections'41 get('/', function(){42 return this.partial('item.haml.html', {42 return this.partial('item.html.haml', {43 collection: ['foo', 'bar']44 })45 })46 get('/').body.should.include '<li>foo'
1 unmodified line
48 end49 50 it 'should render collections with a given object name'51 get('/', function(){52 return this.partial('video.haml.html', {52 return this.partial('video.html.haml', {53 collection: ['im a movie', 'im another movie'],54 as: 'vid'55 })56 })
2 unmodified lines
59 end60 61 it 'should pass __isFirst__, __isLast__, and __index__ to partials as locals'62 get('/', function(){63 return this.partial('article.haml.html', {63 return this.partial('article.html.haml', {64 collection: ['a', 'b', 'c']65 })66 })67 get('/').body.should.include '<li class="first">a'
10 unmodified lines
78 79 describe 'given a callback'80 it 'should be passed the rendered content'81 get('/', function(){82 this.render('hello.haml.html', {}, function(err, content){82 this.render('hello.html.haml', {}, function(err, content){83 if (err) this.error(err)84 else this.halt(203, content)85 })86 })
5 unmodified lines
92 describe 'given a valid view name'93 describe 'and layout of the same type exists'94 it 'should render the layout and view'95 get('/', function(){96 this.render('hello.haml.html')96 this.render('hello.html.haml')97 })98 get('/').body.should.include '<html><body>'99 get('/').body.should.include '<h2>Hello'100 end101 102 it 'should default context to the current request'103 get('/', function(){104 this.title = 'Welcome'105 this.render('page.haml.html', { layout: false })105 this.render('page.html.haml', { layout: false })106 })107 get('/').body.should.include '<title>Welcome'108 end109 110 it 'should set the content type based on the last path segment'111 get('/', function(){112 this.render('hello.haml.html')112 this.render('hello.html.haml')113 })114 get('/').headers['content-type'].should.eql 'text/html'115 end116 end117 118 describe 'and layout of the same type does not exist'119 it 'should throw an error'120 get('/', function(){121 this.render('hello.haml.html', { layout: 'front' })121 this.render('hello.html.haml', { layout: 'front' })122 })123 -{ get('/') }.should.throw_error 'No such file or directory'124 end125 end
1 unmodified line
127 describe 'given a custom layout name'128 it 'should render the layout and view'129 get('/', function(){130 this.title = 'Express'131 this.render('hello.haml.html', { layout: 'page' })131 this.render('hello.html.haml', { layout: 'page' })132 })133 get('/').body.should.include '<title>Express'134 get('/').body.should.include '<h2>Hello'135 end
1 unmodified line
137 138 describe 'when layout: false'139 it 'should render the view only'140 get('/', function(){141 this.render('hello.haml.html', { layout: false })141 this.render('hello.html.haml', { layout: false })142 })143 get('/').body.should.not.include '<body>'144 get('/').body.should.include '<h2>Hello'145 end
1 unmodified line
147 148 describe 'when engine cannot be found'149 it 'should throw an error'150 get('/', function(){151 this.render('user.invalid.html')151 this.render('user.html.invalid')152 })153 -{ get('/') }.should.throw_error "Cannot find module 'invalid'"154 end155 end156 157 describe 'when locals are passed'158 it 'should have direct access to locals'159 get('/user', function(){160 this.render('user.haml.html', {160 this.render('user.html.haml', {161 locals: {162 name: 'tj',163 email: 'tj@vision-media.ca'164 }
4 unmodified lines
169 end170 171 it 'should have direct access to locals within the layout'172 get('/user', function(){173 this.render('user.haml.html', {173 this.render('user.html.haml', {174 layout: 'layout.user',175 locals: {176 name: 'tj',177 email: 'tj@vision-media.ca'
8 unmodified lines
186 187 describe 'when context is passed'188 it 'should evaluate in context to that object'189 get('/article', function(){190 this.render('article.haml.html', {190 this.render('article.html.haml', {191 context: {192 name: 'Writing a Node.js Web Application'193 }194 })
10 unmodified lines