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-2003 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="hc_nodereplacechildnewchildexists">
  15. <metadata>
  16. <title>hc_nodeReplaceChildNewChildExists</title>
  17. <creator>Curt Arnold</creator>
  18. <description>
  19.    If the "newChild" is already in the tree, it is first
  20.    removed before the new one is added.
  21.  
  22.    Retrieve the second "p" and replace "acronym" with its "em".
  23. </description>
  24. <date qualifier="created">2002-06-09</date>
  25. <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-785887307"/>
  26. <subject resource="http://www.w3.org/Bugs/Public/show_bug.cgi?id=246"/>
  27. </metadata>
  28. <var name="doc" type="Document"/>
  29. <var name="elementList" type="NodeList"/>
  30. <var name="employeeNode" type="Node"/>
  31. <var name="childList" type="NodeList"/>
  32. <var name="oldChild" type="Node" isNull="true"/>
  33. <var name="newChild" type="Node" isNull="true"/>
  34. <var name="child" type="Node"/>
  35. <var name="childName" type="DOMString"/>
  36. <var name="childNode" type="Node"/>
  37. <var name="actual" type="List"/>
  38. <var name="expected" type="List">
  39. <member>"strong"</member>
  40. <member>"code"</member>
  41. <member>"sup"</member>
  42. <member>"var"</member>
  43. <member>"em"</member>
  44. </var>
  45. <var name="replacedChild" type="Node"/>
  46. <var name="nodeType" type="int"/>
  47. <load var="doc" href="hc_staff" willBeModified="true"/>
  48. <getElementsByTagName interface="Document" obj="doc" tagname='"p"' var="elementList"/>
  49. <item interface="NodeList" obj="elementList" index="1" var="employeeNode"/>
  50. <getElementsByTagName interface="Element" obj="employeeNode" var="childList" tagname='"*"'/>
  51. <item interface="NodeList" obj="childList" index="0" var="newChild"/>
  52. <item interface="NodeList" obj="childList" index="5" var="oldChild"/>
  53. <replaceChild var="replacedChild" obj="employeeNode" newChild="newChild" oldChild="oldChild"/>
  54. <assertSame actual="replacedChild" expected="oldChild" id="return_value_same"/>
  55. <for-each collection="childList" member="childNode">
  56. <nodeName var="childName" obj="childNode"/>
  57. <nodeType var="nodeType" obj="childNode"/>
  58. <if><equals actual="nodeType" expected="1"/>
  59. <append collection="actual" item="childName"/>
  60. <else>
  61. <assertEquals actual="nodeType" expected="3" id="textNodeType" ignoreCase="false"/>
  62. <assertEquals actual="childName" expected='"#text"' id="textNodeName" ignoreCase="false"/>
  63. </else>
  64. </if>
  65. </for-each>
  66. <assertEquals actual="actual" expected="expected" id="childNames" ignoreCase="auto"/>
  67. </test>
  68.