trunk/resources/tests/dom3/Core/userdatahandler01.xml
changeset 0 5057afe1ec87
equal deleted inserted replaced
-1:000000000000 0:5057afe1ec87
       
     1 <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
       
     2 
       
     3 <!--
       
     4 
       
     5 Copyright (c) 2004 World Wide Web Consortium, 
       
     6 (Massachusetts Institute of Technology, Institut National de
       
     7 Recherche en Informatique et en Automatique, Keio University).  All 
       
     8 Rights Reserved.  This program is distributed under the W3C's Software
       
     9 Intellectual Property License.  This program is distributed in the 
       
    10 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
       
    11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
       
    12 PURPOSE.  
       
    13 
       
    14 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
       
    15 
       
    16 -->
       
    17 
       
    18 
       
    19 <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="userdatahandler01">
       
    20 <metadata>
       
    21 <title>userdatahandler01</title>
       
    22 <creator>Curt Arnold</creator>
       
    23 <description>
       
    24 Call setUserData on a node providing a UserDataHandler and rename the node.
       
    25 </description>
       
    26 <date qualifier="created">2004-01-16</date>
       
    27 <subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-handleUserDataEvent"/>
       
    28 </metadata>
       
    29 <var name="doc" type="Document"/>
       
    30 <var name="node" type="Node"/>
       
    31 <var name="pList" type="NodeList"/>
       
    32 <var name="userDataMonitor" type="UserDataMonitor"/>
       
    33 <var name="oldUserData" type="DOMUserData"/>
       
    34 <var name="elementNS" type="DOMString"/>
       
    35 <var name="newNode" type="Node"/>
       
    36 <var name="notifications" type="List"/>
       
    37 <var name="notification" type="UserDataNotification"/>
       
    38 <var name="operation" type="short"/>
       
    39 <var name="key" type="DOMString"/>
       
    40 <var name="data" type="DOMString"/>
       
    41 <var name="src" type="Node"/>
       
    42 <var name="dst" type="Node"/>
       
    43 <var name="greetingCount" type="int" value="0"/>
       
    44 <var name="salutationCount" type="int" value="0"/>
       
    45 <var name="hello" type="DOMString" value='"Hello"'/>
       
    46 <var name="mister" type="DOMString" value='"Mr."'/>
       
    47 
       
    48 <load var="doc" href="barfoo" willBeModified="true"/>
       
    49 <getElementsByTagName var="pList" obj="doc" tagname='"p"' interface="Document"/>
       
    50 <item var="node" obj="pList" index="0" interface="NodeList"/>
       
    51 <setUserData var="oldUserData" obj="node" key='"greeting"' data='hello' handler="userDataMonitor"/>
       
    52 <setUserData var="oldUserData" obj="node" key='"salutation"' data='mister' handler="userDataMonitor"/>
       
    53 <namespaceURI var="elementNS" obj="node" interface="Node"/>
       
    54 <renameNode var="newNode" obj="doc" n="node" namespaceURI="elementNS" qualifiedName='"div"'/>
       
    55 <allNotifications var="notifications" obj="userDataMonitor"/>
       
    56 <assertSize size="2" collection="notifications" id="twoNotifications"/>
       
    57 <for-each member="notification" collection="notifications">
       
    58 	<operation var="operation" obj="notification"/>
       
    59 	<assertEquals actual="operation" expected="4" ignoreCase="false" id="operationIsRename"/>
       
    60 	<key var="key" obj="notification"/>
       
    61 	<data var="data" obj="notification" interface="UserDataNotification"/>
       
    62 	<if>
       
    63 		<equals actual="key" expected='"greeting"' ignoreCase="false"/>
       
    64 		<assertEquals actual="data" expected='hello' ignoreCase="false" id="greetingDataHello"/>
       
    65 		<increment var="greetingCount" value="1"/>
       
    66 		<else>
       
    67 			<assertEquals actual="key" expected='"salutation"' ignoreCase="false" id="saluationKey"/>
       
    68 			<assertEquals actual="data" expected='mister' ignoreCase="false" id="salutationDataMr"/>
       
    69 			<increment var="salutationCount" value="1"/>
       
    70 		</else>
       
    71 	</if>
       
    72 	<src interface="UserDataNotification" var="src" obj="notification"/>
       
    73 	<assertSame actual="src" expected="node" id="srcIsNode"/>
       
    74 	<dst var="dst" obj="notification"/>
       
    75 	<if>
       
    76 		<!-- will be null if no node needs to be newly created  -->
       
    77 		<isNull obj="dst"/>
       
    78 		<assertSame actual="newNode" expected="node" id="ifDstNullRenameMustReuseNode"/>
       
    79 		<else>
       
    80 			<!-- otherwise will be same as newNode   -->
       
    81 			<assertSame actual="dst" expected="newNode" id="dstIsNewNode"/>
       
    82 		</else>
       
    83 	</if>
       
    84 </for-each>
       
    85 <assertEquals actual="greetingCount" expected="1" ignoreCase="false" id="greetingCountIs1"/>
       
    86 <assertEquals actual="salutationCount" expected="1" ignoreCase="false" id="salutationCountIs1"/>
       
    87 </test>