Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleaned up extra blanks at eol

  • Loading branch information...
commit 8a2e47162841514b4b5ff5669370d54b2a0736a3 1 parent 4925b11
@shimaore shimaore authored
View
40 CHANGELOG.md
@@ -177,47 +177,47 @@
**v0.3.0 "The Gumbo Variations"** (2011-09-29):
- Changed: "magic locals" replaced by properties of `this` (`get` becomes `@get`). See #74 and the [announcement](http://zappajs.org/docs/0.3-gumbo/announcement).
-
+
- Backtraces now show the relevant file and (js) file number.
-
+
- Normal JS scope restored: `def`, `zappa {foo}, ->` etc gone.
-
+
- Changed: automatic input "importing" and "exporting" to templates now optional through the `databag` setting. See #84.
-
+
- Changed: removed hard dependency on `jsdom`. To use `@postrender`, `npm install jsdom` first.
**v0.2.1** (2011-09-22):
- Changed: using standard jquery from code.jquery.com instead of node-jquery. Updated to 1.6.4.
-
+
- Changed: updated sammy to 0.7.0.
-
+
- Fixed #80: Default layout is not being added correctly.
**v0.2.0 "Peaches en Regalia"** (2011-09-08):
- Changed: externals (`zappa {foo} ->`) are available at all scopes, shadow globals and root scope locals.
-
+
- Fixed: inline templates with multiple apps.
-
+
- Added `stylus` to the root scope (compiles string with stylus and serves it as css).
-
+
- Fixed #58: multiple socket events fail. Also applied the same fix to helpers.
-
+
- Changed `zappa.run` to interpret a number-castable string param as the port, to better integrate with Heroku. Closes #61 [Tim Shadel]
-
+
- Fixed #64: require does not pick up node_modules in app dir. [Jason King]
-
+
- Added: setting views dir to `__dirname + '/views'` by default. Closes #71. [rachel-carvalho]
-
+
- Added the `minify` setting, which uses uglify-js to minify the outputs of `serve zappa`, `client`, `shared`, `coffee` and `js`. Closes #70 (thanks @jacobrask).
-
+
- Added back `session` to the request handlers scope. [shimaore]
**v0.2.0beta** (2011-08-02):
- Complete rewrite, see `/docs/peaches.md` for a more in-depth review on changes.
-
+
- Fixed performance, now negligible overhead on top of express. Gone with the `with` keyword.
- Scraped the `zappa` command, zappa code should go in `require('zappa') ->` blocks. All node tools and services can be used directly.
@@ -225,15 +225,15 @@
- Changed `include`, now implemented through standard module mechanisms. Code to be included must be exported: `@include = ->`.
- Added `app` and `io` variables to all scopes, providing direct access to express and socket.io.
-
+
- Added optimized interfaces to express features such as `use`, `set`, `enable`, `disable`, `configure`, etc.
-
+
- Changed `render`, now uses the rendering system from express, with all its features. Defining inline templates with `view` and passing variables through `@` is still possible.
-
+
- Added an optional client-side API that can be used with `client`. To just serve code as JS, use `coffee`.
-
+
- Added `shared`, allows sharing code between client and server.
-
+
- Removed most zappa's defaults, added very concise APIs to define what you need.
**v0.1.5** (2011-05-06):
View
12 Cakefile
@@ -1,19 +1,19 @@
{spawn, exec} = require 'child_process'
log = console.log
-
+
task 'build', ->
run 'coffee -o lib -c src/*.coffee'
-
+
task 'test', ->
# Set `ulimit -n 1024` if you run out of descriptors.
run 'coffee tests/index.coffee'
-
+
task 'bench', ->
run 'cd benchmarks && ./run'
-
+
task 'docs', ->
run 'docco src/*.coffee'
-
+
task 'vendor', ->
run 'mkdir -p vendor && cd vendor && curl -OL http://code.jquery.com/jquery-1.8.3.min.js', ->
run 'cd vendor && curl -OL https://github.com/quirkey/sammy/raw/master/lib/min/sammy-0.7.4.min.js', ->
@@ -37,7 +37,7 @@ run = (args...) ->
if a instanceof Array then params = a
else options = a
when 'function' then callback = a
-
+
command += ' ' + params.join ' ' if params?
cmd = spawn '/bin/sh', ['-c', command], options
cmd.stdout.on 'data', (data) -> process.stdout.write data
View
2  docs/crashcourse.md
@@ -17,7 +17,7 @@ Get a `cuppa.coffee`:
And give your foot a push:
$ npm install zappajs
- $ coffee cuppa.coffee
+ $ coffee cuppa.coffee
info - socket.io started
Express server listening on port 3000 in development mode
Zappa 0.3.1 "The Gumbo Variations" orchestrating the show
View
12 examples/chatrooms.coffee
@@ -1,8 +1,8 @@
require('./zappajs') ->
-
+
@get '/': ->
@render index: {layout: no}
-
+
@on 'set nickname': ->
@client.nickname = @data.nickname
@emit 'said', {nickname: 'moderator', msg: 'Your name is ' + @data.nickname}
@@ -18,19 +18,19 @@ require('./zappajs') ->
nickname: @client.nickname
msg: @data.msg
@broadcast_to @client.room, 'said', data
-
+
@client '/index.js': ->
@connect()
@on said: ->
$('#panel').append "<p>#{@data.nickname} said: #{@data.msg}</p>"
-
+
$ =>
@emit 'set nickname': {nickname: prompt 'Pick a nickname!'}
@emit 'set room': {room: prompt 'Pick a room!'}
-
+
$('#box').focus()
-
+
$('#sendButton').click (e) =>
@emit said: {msg: $('#box').val()}
$('#box').val('').focus()
View
2  examples/postrender.coffee
@@ -1,6 +1,6 @@
require('./zappajs') ->
@enable 'default layout'
-
+
@get '/': ->
@user = plan: 'staff'
View
14 examples/views.coffee
@@ -4,17 +4,17 @@ require('./zappajs') ->
@get
'/': ->
@render 'index', foo: 'bar'
-
+
'/eco': ->
@render 'index.eco', foo: 'bar'
-
+
'/jade': ->
@render 'index.jade', foo: 'bar'
@view index: ->
h2 'CoffeeCup inline template'
p @foo
-
+
@view layout: ->
doctype 5
html ->
@@ -23,12 +23,12 @@ require('./zappajs') ->
body ->
h1 'CoffeeCup inline layout'
@body
-
+
@view 'index.eco': '''
<h2>Eco inline template</h2>
<p><%= @foo %></p>
'''
-
+
@view 'layout.eco': '''
<!DOCTYPE html>
<html>
@@ -40,12 +40,12 @@ require('./zappajs') ->
</body>
</html>
'''
-
+
@view 'index.jade': '''
h2 Jade inline template
p= foo
'''
-
+
@view 'layout.jade': '''
!!! 5
html
View
28 tests/assets.coffee
@@ -5,7 +5,7 @@ port = 15200
client: (t) ->
t.expect 1, 2, 3, 4, 5
t.wait 3000
-
+
zapp = zappa port++, ->
@client '/index.js': ->
@get '#/': -> alert 'hi'
@@ -24,7 +24,7 @@ port = 15200
coffee: (t) ->
t.expect 1, 2
t.wait 3000
-
+
zapp = zappa port++, ->
@coffee '/coffee.js': ->
alert 'hi'
@@ -47,7 +47,7 @@ port = 15200
c.get '/js.js', (err, res) ->
t.equal 1, res.body, "alert('hi');"
t.equal 2, res.headers['content-type'], 'application/javascript'
-
+
css: (t) ->
t.expect 1, 2
t.wait 3000
@@ -101,12 +101,12 @@ port = 15200
@with css:'stylus'
@stylus '/index.css': '''
border-radius()
- -webkit-border-radius arguments
- -moz-border-radius arguments
- border-radius arguments
+ -webkit-border-radius arguments
+ -moz-border-radius arguments
+ border-radius arguments
body
- font 12px Helvetica, Arial, sans-serif
+ font 12px Helvetica, Arial, sans-serif
a.button
border-radius 5px
@@ -124,7 +124,7 @@ port = 15200
-moz-border-radius: 5px;
border-radius: 5px;
}
-
+
'''
less: (t) ->
@@ -167,7 +167,7 @@ port = 15200
jquery: (t) ->
t.expect 'content-type', 'length'
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'zappa'
@@ -179,7 +179,7 @@ port = 15200
sammy: (t) ->
t.expect 'content-type', 'length'
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'zappa'
@@ -202,7 +202,7 @@ port = 15200
zappa: (t) ->
t.expect 'content-type', 'snippet'
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'zappa'
@@ -226,7 +226,7 @@ port = 15200
'zappa (automatic)': (t) ->
t.expect 'content-type', 'snippet'
t.wait 3000
-
+
zapp = zappa port++, ->
@client '/index.js': ->
@@ -234,11 +234,11 @@ port = 15200
c.get '/zappa/zappa.js', (err, res) ->
t.equal 'content-type', res.headers['content-type'], 'application/javascript'
t.ok 'snippet', res.body.indexOf('window.zappa = {};') > -1
-
+
minify: (t) ->
t.expect 'zappa', 'client', 'shared', 'coffee', 'js'
t.wait 3000
-
+
zapp = zappa port++, ->
@enable 'minify'
@client '/client.js': -> alert 'foo'
View
10 tests/helpers.coffee
@@ -5,7 +5,7 @@ port = 15100
http: (t) ->
t.expect 1, 2
t.wait 3000
-
+
zapp = zappa port++, ->
@helper role: (name) ->
if @request?
@@ -14,9 +14,9 @@ port = 15100
@get '/': ->
@user = role: 'commoner'
@role 'lord'
-
+
c = t.client(zapp.server)
-
+
c.get '/', (err, res) ->
t.equal 1, res.statusCode, 302
t.ok 2, res.headers.location.match /\/login$/
@@ -24,7 +24,7 @@ port = 15100
multiple: (t) ->
t.expect 1, 2
t.wait 3000
-
+
zapp = zappa port++, ->
@helper sum: (a, b) -> a + b
@helper subtract: (a, b) -> a - b
@@ -32,7 +32,7 @@ port = 15100
@get '/': ->
t.equal 1, @sum(1, 2), 3
t.equal 2, @subtract(1, 2), -1
-
+
c = t.client(zapp.server)
c.get '/'
View
28 tests/middleware.coffee
@@ -5,15 +5,15 @@ port = 15500
'vanilla express API': (t) ->
t.expect 'static', 'response time'
t.wait 3000
-
+
zapp = zappa port++, ->
@app.use @express.static(__dirname + '/public')
@app.use @express.responseTime()
-
+
c = t.client(zapp.server)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
-
+
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
@@ -39,53 +39,53 @@ port = 15500
use: (t) ->
t.expect 'static', 'response time'
t.wait 3000
-
+
zapp = zappa port++, ->
@use @express.static(__dirname + '/public'), @express.responseTime()
-
+
c = t.client(zapp.server)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
-
+
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
'use + shortcuts': (t) ->
t.expect 'static', 'response time'
t.wait 3000
-
+
zapp = zappa port++, ->
@use static: __dirname + '/public', 'responseTime'
-
+
c = t.client(zapp.server)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
-
+
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
'use + shortcuts + zappa added defaults': (t) ->
t.expect 'static', 'response time'
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'static', 'responseTime'
-
+
c = t.client(zapp.server)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'bar'
-
+
c.get '/', (err, res) ->
t.ok 'response time', res.headers['x-response-time'].match /\d+ms/
precedence: (t) ->
t.expect 'static'
t.wait 3000
-
+
zapp = zappa port++, ->
@use @app.router, 'static'
@get '/foo.txt': 'intercepted!'
-
+
c = t.client(zapp.server)
c.get '/foo.txt', (err, res) ->
t.equal 'static', res.body, 'intercepted!'
View
18 tests/routes.coffee
@@ -5,14 +5,14 @@ port = 15000
hello: (t) ->
t.expect 1, 2, 3, 4, 5
t.wait 3000
-
+
zapp = zappa port++, ->
@get '/string': 'string'
@get '/return': -> 'return'
@get '/send': -> @send 'send'
@get /\/regex$/, 'regex'
@get /\/regex_function$/, -> 'regex function'
-
+
c = t.client(zapp.server)
c.get '/string', (err, res) -> t.equal 1, res.body, 'string'
c.get '/return', (err, res) -> t.equal 2, res.body, 'return'
@@ -23,12 +23,12 @@ port = 15000
verbs: (t) ->
t.expect 1, 2, 3
t.wait 3000
-
+
zapp = zappa port++, ->
@post '/': -> 'post'
@put '/': -> 'put'
@del '/': -> 'del'
-
+
c = t.client(zapp.server)
c.post '/', (err, res) -> t.equal 1, res.body, 'post'
c.put '/', (err, res) -> t.equal 2, res.body, 'put'
@@ -37,10 +37,10 @@ port = 15000
redirect: (t) ->
t.expect 1, 2
t.wait 3000
-
+
zapp = zappa port++, ->
@get '/': -> @redirect '/foo'
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.statusCode, 302
@@ -49,17 +49,17 @@ port = 15000
params: (t) ->
t.expect 1, 2
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'bodyParser'
@get '/:foo': -> @params.foo + @query.ping
@post '/:foo': -> @params.foo + @query.ping + @body.zig
-
+
c = t.client(zapp.server)
c.get '/bar?ping=pong', (err, res) ->
t.equal 1, res.body, 'barpong'
-
+
headers = 'Content-Type': 'application/x-www-form-urlencoded'
json = {zig: 'zag'}
c.post '/bar?ping=pong', {headers, json}, (err, res) ->
View
6 tests/sockets.coffee
@@ -5,7 +5,7 @@ port = 15700
connects: (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@on connection: ->
t.reached 1
@@ -16,7 +16,7 @@ port = 15700
'server emits': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@on connection: ->
@emit 'welcome'
@@ -30,7 +30,7 @@ port = 15700
'server broadcasts': (t) ->
t.expect 'reached1', 'reached2', 'data1', 'data2'
t.wait 10000
-
+
zapp = zappa port++, ->
@on shout: ->
@broadcast 'shouted', @data
View
4 tests/support/client.coffee
@@ -46,12 +46,12 @@ class Client
else cb(null, res, window)
else
cb(null, res) if cb?
-
+
get: (args...) -> @request 'get', args...
post: (args...) -> @request 'post', args...
put: (args...) -> @request 'put', args...
del: (args...) -> @request 'delete', args...
-
+
connect: -> @socket = io.connect("http://#{@host}:#{@port}")
on: -> @socket.on.apply @socket, arguments
emit: -> @socket.emit.apply @socket, arguments
View
26 tests/support/tester.coffee
@@ -34,13 +34,13 @@ uncaught = []
@add = (p) ->
file = path.basename(require.resolve p)
-
+
for title, test of require(p).tests
do (title, test) ->
full_title = file + ': ' + title
-
+
tests[full_title] = test
-
+
test.t =
title: title
file: file
@@ -49,7 +49,7 @@ uncaught = []
waits: {}
passed: {}
failed: {}
-
+
client: client
all_passed: ->
@@ -84,7 +84,7 @@ uncaught = []
expect: ->
@expected[a] = true for a in arguments
-
+
wait: (ms) ->
id = timeout ms, =>
delete @waits[id]
@@ -95,7 +95,7 @@ uncaught = []
if not done[@full_title]
if @ran? and (_(@expected).isEmpty() or _(@waits).isEmpty())
@end()
-
+
end: ->
clearInterval(k) for k, v of @waits
done[@full_title] = @
@@ -110,26 +110,26 @@ uncaught = []
catch e
t.error = e
t.end()
-
+
t.ran = yes
t.end_check()
finish_him = ->
line = ('-' for i in [1..40]).join('')
log ''
-
+
passed = 0
failed = 0
timedout = 0
errors = 0
-
+
for full_title, test of tests
do (full_title, test) ->
t = done[full_title]
if not t.all_passed() or t.error
log full_title
log line
-
+
for k, v of t.passed
passed++
log "#{green}#{reset} #{k}"
@@ -151,9 +151,9 @@ finish_him = ->
errors++
log "#{red}✖ Error:#{reset}"
log t.error.stack
-
+
log ''
-
+
if uncaught.length > 0
log "#{uncaught.length} Uncaught error(s):"
for e in uncaught
@@ -175,7 +175,7 @@ finish_him = ->
log "#{new Date - start} ms\n"
process.exit()
-
+
process.on 'uncaughtException', (err) ->
uncaught.push err
throw err
View
86 tests/views.coffee
@@ -5,7 +5,7 @@ port = 15600
inline: (t) ->
t.expect 1, 2
t.wait 3000
-
+
zapp = zappa port++, ->
@get '/bar': ->
@render 'index', foo: 'bar', layout: no
@@ -13,7 +13,7 @@ port = 15600
@render 'index', foo: 'foobar', layout: no
@view index: -> h2 "CoffeeKup inline template: #{@foo}"
-
+
c = t.client(zapp.server)
c.get '/bar', (err, res) ->
t.equal 1, res.body, '<h2>CoffeeKup inline template: bar</h2>'
@@ -44,20 +44,20 @@ port = 15600
'inline + inline layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'partials'
@get '/': ->
@render 'index', foo: 'bar'
@view index: -> h2 "CoffeeKup inline template: #{@foo}"
-
+
@view layout: ->
doctype 5
html ->
head ->
title 'CoffeeKup inline layout'
- body @body
+ body @body
c = t.client(zapp.server)
c.get '/', (err, res) ->
@@ -88,11 +88,11 @@ port = 15600
file: (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@get '/': ->
@render 'index', foo: 'bar', layout: no
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<h2>CoffeeKup file template: bar</h2>'
@@ -100,12 +100,12 @@ port = 15600
'file + file layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'partials'
@get '/': ->
@render 'index', foo: 'bar'
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html><html><head><title>CoffeeKup file layout</title></head><body><h2>CoffeeKup file template: bar</h2></body></html>'
@@ -113,11 +113,11 @@ port = 15600
'response.render, file': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@get '/': ->
@response.render 'index', foo: 'bar', layout: no
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<h2>CoffeeKup file template: bar</h2>'
@@ -125,12 +125,12 @@ port = 15600
'response.render, file + file layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'partials'
@get '/': ->
@response.render 'index', foo: 'bar'
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html><html><head><title>CoffeeKup file layout</title></head><body><h2>CoffeeKup file template: bar</h2></body></html>'
@@ -138,16 +138,16 @@ port = 15600
'eco, inline': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@app.engine 'eco', require('consolidate').eco
@set 'view engine': 'eco'
-
+
@get '/': ->
@render 'index', foo: 'bar', layout: no
@view index: "<h2>Eco inline template: <%= @foo %></h2>"
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<h2>Eco inline template: bar</h2>'
@@ -155,12 +155,12 @@ port = 15600
'eco, inline + inline layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@app.engine 'eco', require('consolidate').eco
@use 'partials'
@set 'view engine': 'eco'
-
+
@get '/': ->
@render 'index', foo: 'bar'
@@ -175,7 +175,7 @@ port = 15600
<body><%- @body %></body>
</html>
'''
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html>\n<html>\n <head>\n <title>Eco inline layout</title>\n </head>\n <body><h2>Eco inline template: bar</h2></body>\n</html>'
@@ -183,15 +183,15 @@ port = 15600
'eco, file': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@app.engine 'eco', require('consolidate').eco
@use 'partials'
@set 'view engine': 'eco'
-
+
@get '/': ->
@render 'index', foo: 'bar', layout: no
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<h2>Eco file template: bar</h2>'
@@ -199,15 +199,15 @@ port = 15600
'eco, file + file layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@app.engine 'eco', require('consolidate').eco
@use 'partials'
@set 'view engine': 'eco'
-
+
@get '/': ->
@render 'index', foo: 'bar'
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html>\n<html>\n <head>\n <title>Eco file layout</title>\n </head>\n <body><h2>Eco file template: bar</h2></body>\n</html>'
@@ -215,13 +215,13 @@ port = 15600
'eco, zappa adapter, inline + inline layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@set 'view engine': 'eco'
@app.engine 'eco', require('consolidate').eco
@use 'partials'
eco: zappa.adapter 'eco'
-
+
@get '/': ->
@render 'index', foo: 'bar'
@@ -236,7 +236,7 @@ port = 15600
<body><%- @body %></body>
</html>
'''
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html>\n<html>\n <head>\n <title>Eco inline layout</title>\n </head>\n <body><h2>Eco inline template: bar</h2></body>\n</html>'
@@ -244,15 +244,15 @@ port = 15600
'jade, inline': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@set 'view engine': 'jade'
-
+
@get '/': ->
@render 'index', foo: 'bar', layout: no
@view index: "h2= 'Jade inline template: ' + foo"
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<h2>Jade inline template: bar</h2>'
@@ -260,11 +260,11 @@ port = 15600
'jade, inline + inline layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'partials'
@set 'view engine': 'jade'
-
+
@get '/': ->
@render 'index', foo: 'bar'
@@ -277,7 +277,7 @@ port = 15600
title Jade inline layout
body!= body
'''
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html><html><head><title>Jade inline layout</title></head><body><h2>Jade inline template: bar</h2></body></html>'
@@ -285,13 +285,13 @@ port = 15600
'jade, file': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@set 'view engine': 'jade'
-
+
@get '/': ->
@render 'index', foo: 'bar', layout: no
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<h2>Jade file template: bar</h2>'
@@ -299,14 +299,14 @@ port = 15600
'jade, file + file layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@use 'partials'
@set 'view engine': 'jade'
-
+
@get '/': ->
@render 'index', foo: 'bar'
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html><html><head><title>Jade file layout</title></head><body><h2>Jade file template: bar</h2></body></html>'
@@ -314,12 +314,12 @@ port = 15600
'jade, zappa adapter, inline + inline layout': (t) ->
t.expect 1
t.wait 3000
-
+
zapp = zappa port++, ->
@set 'view engine': 'jade'
@use 'partials'
jade: zappa.adapter 'jade'
-
+
@get '/': ->
@render 'index', foo: 'bar'
@@ -332,7 +332,7 @@ port = 15600
title Jade inline layout
body!= body
'''
-
+
c = t.client(zapp.server)
c.get '/', (err, res) ->
t.equal 1, res.body, '<!DOCTYPE html><html><head><title>Jade inline layout</title></head><body><h2>Jade inline template: bar</h2></body></html>'
Please sign in to comment.
Something went wrong with that request. Please try again.