1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
suite 'Tests specific to issues:', ->
test 'Option to add space before closing tag. Issue 157', ->
eq(
xml('root')
.dtd('hello.dtd')
.ins('pub_border', 'thin')
.ele('img', 'EMPTY')
.att('img', 'height', 'CDATA', '#REQUIRED')
.not('fs', { sysID: 'http://my.fs.com/reader' })
.ent('ent', 'my val')
.pent('ent', 'my val')
.root()
.ins('a', 'b')
.ele('xmlbuilder')
.end({ pretty: true, spacebeforeslash: ' ' })
"""
<?xml version="1.0" ?>
<!DOCTYPE root SYSTEM "hello.dtd" [
<?pub_border thin ?>
<!ELEMENT img EMPTY >
<!ATTLIST img height CDATA #REQUIRED >
<!NOTATION fs SYSTEM "http://my.fs.com/reader" >
<!ENTITY ent "my val" >
<!ENTITY % ent "my val" >
] >
<root>
<?a b ?>
<xmlbuilder />
</root>
"""
)
test 'Fragment', ->
eq(
xml('root').toString({ spacebeforeslash: true })
'<root />'
)
|