UNPKG

1.19 kBtext/coffeescriptView Raw
1cc = require '../lib/coffeecup'
2
3describe 'custom', ->
4 describe '#tag(name, attr)', ->
5 it 'should render', ->
6 t = -> tag 'custom'
7 cc.render(t).should.equal '<custom></custom>'
8 it 'should render with attributes', ->
9 t = -> tag 'custom', foo: 'bar', ping: 'pong'
10 cc.render(t).should.equal '<custom foo="bar" ping="pong"></custom>'
11 it 'should render with attributes and inner attributes', ->
12 t = -> tag 'custom', foo: 'bar', ping: 'pong', -> 'zag'
13 cc.render(t).should.equal '<custom foo="bar" ping="pong">zag</custom>'
14
15describe 'custom optimized', ->
16 describe '#tag(name, attr)', ->
17 it 'should render', ->
18 t = -> tag 'custom'
19 cc.render(t, optimized: true, cache: on).should.equal '<custom></custom>'
20 it 'should render with attributes', ->
21 t = -> tag 'custom', foo: 'bar', ping: 'pong'
22 cc.render(t, optimized: true, cache: on).should.equal '<custom foo="bar" ping="pong"></custom>'
23 it 'should render with attributes and inner attributes', ->
24 t = -> tag 'custom', foo: 'bar', ping: 'pong', -> 'zag'
25 cc.render(t, optimized: true, cache: on).should.equal '<custom foo="bar" ping="pong">zag</custom>'