Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Copyright (c) 2001-2004 World Wide Web Consortium,
  4. (Massachusetts Institute of Technology, Institut National de
  5. Recherche en Informatique et en Automatique, Keio University). All
  6. Rights Reserved. This program is distributed under the W3C's Software
  7. Intellectual Property License. This program is distributed in the
  8. hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  9. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  10. PURPOSE.
  11. See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  12. --><!DOCTYPE test SYSTEM "dom1.dtd">
  13.  
  14. <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="namednodemapsetnameditemthatexists">
  15. <metadata>
  16. <title>namednodemapSetNamedItemThatExists</title>
  17. <creator>NIST</creator>
  18. <description>
  19.    If the node to be added by the "setNamedItem(arg)" method
  20.   already exists in the NamedNodeMap, it is replaced by
  21.   the new one.
  22.  
  23.   Retrieve the second employee and create a NamedNodeMap
  24.   object from the attributes of the last child by
  25.   invoking the "getAttributes()" method.  Once the
  26.   list is created an invocation of the "setNamedItem(arg)"
  27.   method is done with arg=newAttr, where newAttr is a
  28.   new Attr Node previously created and whose node name
  29.   already exists in the map.  The "setNamedItem(arg)"
  30.   method should replace the already existing node with
  31.   the new one.  
  32.   This node is then retrieved using the "getNamedItem(name)"
  33.   method.  This test uses the "createAttribute(name)"
  34.   method from the document interface
  35. </description>
  36. <contributor>Mary Brady</contributor>
  37. <date qualifier="created">2001-08-17</date>
  38. <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1025163788"/>
  39. <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-349467F9"/>
  40. </metadata>
  41. <var name="doc" type="Document"/>
  42. <var name="elementList" type="NodeList"/>
  43. <var name="newAttribute" type="Attr"/>
  44. <var name="testAddress" type="Node"/>
  45. <var name="attributes" type="NamedNodeMap"/>
  46. <var name="districtNode" type="Attr"/>
  47. <var name="attrValue" type="DOMString"/>
  48. <var name="setNode" type="Node"/>
  49. <load var="doc" href="staff" willBeModified="true"/>
  50. <getElementsByTagName interface="Document" obj="doc" var="elementList" tagname="&quot;address&quot;"/>
  51. <item interface="NodeList" obj="elementList" var="testAddress" index="1"/>
  52. <createAttribute obj="doc" var="newAttribute" name="&quot;street&quot;"/>
  53. <attributes obj="testAddress" var="attributes"/>
  54. <setNamedItem var="setNode" obj="attributes" arg="newAttribute"/>
  55. <getNamedItem obj="attributes" var="districtNode" name="&quot;street&quot;"/>
  56. <nodeValue obj="districtNode" var="attrValue"/>
  57. <assertEquals actual="attrValue" expected="&quot;&quot;"
  58.         id="streetValue" ignoreCase="false"/>
  59. </test>
  60.