UNPKG

1.35 kBtext/coffeescriptView Raw
1cc = require '../lib/coffeecup'
2
3describe 'Self Closing Tags', ->
4 describe '#img(name, attr)', ->
5 it 'should render', ->
6 t = -> img()
7 cc.render(t).should.equal '<img />'
8 it 'should render with attributes', ->
9 t = -> img src: 'http://foo.jpg.to'
10 cc.render(t).should.equal '<img src="http://foo.jpg.to" />'
11 describe '#br()', ->
12 it 'should render', ->
13 t = -> br()
14 cc.render(t).should.equal '<br />'
15 describe '#link()', ->
16 it 'should render with attributes', ->
17 t = -> link href: '/foo.css', rel: 'stylesheet'
18 cc.render(t).should.equal '<link href="/foo.css" rel="stylesheet" />'
19
20describe 'Self Closing Tags optimized', ->
21 describe '#img(name, attr)', ->
22 it 'should render', ->
23 t = -> img()
24 cc.render(t, optimized: true, cache: on).should.equal '<img />'
25 it 'should render with attributes', ->
26 t = -> img src: 'http://foo.jpg.to'
27 cc.render(t).should.equal '<img src="http://foo.jpg.to" />'
28 describe '#br()', ->
29 it 'should render', ->
30 t = -> br()
31 cc.render(t, optimized: true, cache: on).should.equal '<br />'
32 describe '#link()', ->
33 it 'should render with attributes', ->
34 t = -> link href: '/foo.css', rel: 'stylesheet'
35 cc.render(t, optimized: true, cache: on).should.equal '<link href="/foo.css" rel="stylesheet" />'