File: 157.coffee

package info (click to toggle)
node-xml2js 0.6.2%2B~cs15.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,312 kB
  • sloc: xml: 119; javascript: 7; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download | duplicates (2)
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 />'
    )