File: 175.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 (25 lines) | stat: -rw-r--r-- 742 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
suite 'Tests specific to issues:', ->
  test 'importDocument overwrites parent declaration: Issue 175', ->

    doc = xml({ factura: {'@id':'comprabante','@version':'2.1.0' }}, {encoding: 'UTF-8'})
      .ele('identificacionComprador', '1303963712')
    doc.ele('node')

    for i in [1..3]
      person = xml('person').att('id', i)
      doc.importDocument(person)
      
    eq(
      doc.end()
      '<?xml version="1.0" encoding="UTF-8"?>' +
      '<factura id="comprabante" version="2.1.0">' +
        '<identificacionComprador>' +
          '1303963712' +
          '<node/>' +
          '<person id="1"/>' +
          '<person id="2"/>' +
          '<person id="3"/>' +
        '</identificacionComprador>' +
      '</factura>'
    )