UNPKG

1.66 kBtext/coffeescriptView Raw
1cc = require '../lib/coffeecup'
2
3describe 'Attributes', ->
4 describe "a href: '/', title: 'Home'", ->
5 it 'should render <a href="/" title="Home"></a>', ->
6 a = -> a href: '/', title: 'Home'
7 cc.render(a).should.equal '<a href="/" title="Home"></a>'
8
9describe 'Attribute values', ->
10 describe "br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->", ->
11 it 'should render <br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />', ->
12 a = -> br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->
13 cc.render(a).should.equal '<br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />'
14
15describe 'Attributes optimized', ->
16 describe "a href: '/', title: 'Home'", ->
17 it 'should render <a href="/" title="Home"></a>', ->
18 a = -> a href: '/', title: 'Home'
19 cc.render(a, optimize: true, cache: on).should.equal '<a href="/" title="Home"></a>'
20
21describe 'Attribute values optimized', ->
22 describe "br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->", ->
23 it 'should render <br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />', ->
24 a = -> br vrai: yes, faux: no, undef: @foo, nil: null, str: 'str', num: 42, arr: [1, 2, 3], obj: {foo: 'bar'}, func: ->
25 cc.render(a, optimize: true).should.equal '<br vrai="vrai" str="str" num="42" arr="1,2,3" obj-foo="bar" func="(function () {}).call(this);" />'