File: 122.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 (19 lines) | stat: -rw-r--r-- 576 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
suite 'Tests specific to issues:', ->
  test 'Get node elements by name. Issue 122', ->

    doc = xml('clients')
      .ele('client').att('city', '').up()
      .ele('client').att('city', 'CA').up()
      .ele('client').att('city', 'FL').up()
      .ele('client').up()
      .doc()

    nodes = xpath.select('//client', doc)
    nodes.forEach (node) ->
      node.att("city","NY")

    eq(nodes[0].attributes.item(0).value, "NY")
    eq(nodes[1].attributes.item(0).value, "NY")
    eq(nodes[2].attributes.item(0).value, "NY")
    eq(nodes[3].attributes.item(0).value, "NY")