UNPKG

2.45 kBtext/coffeescriptView Raw
1cc = require '../lib/coffeecup'
2
3describe 'doctype', ->
4 it 'default should render html5 doctype', ->
5 template = "doctype()"
6 expected = '<!DOCTYPE html>'
7 cc.render(template).should.equal expected
8 it 'xml should render xml header', ->
9 template = "doctype 'xml'"
10 expected = '<?xml version="1.0" encoding="utf-8" ?>'
11 cc.render(template).should.equal expected
12 it '5 should render html 5 doctype', ->
13 template = "doctype 5"
14 expected = '<!DOCTYPE html>'
15 cc.render(template).should.equal expected
16 it 'transitional should render transitional doctype', ->
17 template = "doctype 'transitional'"
18 expected = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
19 cc.render(template).should.equal expected
20
21# 'strict': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
22# 'frameset': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'
23# '1.1': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
24# 'basic': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">'
25# 'mobile': '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">'
26# 'ce': '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "ce-html-1.0-transitional.dtd">'
27
28describe 'doctype optimized', ->
29 it 'default should render html5 doctype', ->
30 template = "doctype()"
31 expected = '<!DOCTYPE html>'
32 cc.render(template, optimized: true, cache: on).should.equal expected
33 it 'xml should render xml header', ->
34 template = "doctype 'xml'"
35 expected = '<?xml version="1.0" encoding="utf-8" ?>'
36 cc.render(template, optimized: true, cache: on).should.equal expected
37 it '5 should render html 5 doctype', ->
38 template = "doctype 5"
39 expected = '<!DOCTYPE html>'
40 cc.render(template, optimized: true, cache: on).should.equal expected
41 it 'transitional should render transitional doctype', ->
42 template = "doctype 'transitional'"
43 expected = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
44 cc.render(template, optimized: true, cache: on).should.equal expected