<?xml version="1.0"?>
<!DOCTYPE testsuite SYSTEM "http://www.w3.org/WAI/UA/TS/dtd/uaag-testsuite-2.dtd">


<testsuite id="ts0102-onclick">
	
	<metaInfo>
		<testTitle>ONCLICK and ONDBCLICK</testTitle>
		<shortTitle>ONCLICK and ONDBCLICK events</shortTitle>
		<testElement>
			<elementName>ONCLICK</elementName>
			<hlink href="http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3">&hspec; ONCLICK</hlink>
		</testElement>
		<testElement>
			<elementName>ONDBCLICK</elementName>
			<hlink href="http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3">&hspec; ONDBCLICK</hlink>
		</testElement>		
		<creator>Dominique Kilman</creator>
		<creator>Colin Koteles</creator>		
		
				
		<metaElement></metaElement>
		<testStyle></testStyle>
	</metaInfo>
	
	<requirementInfo>
   	<checkpoints>
      	<checkpoint xref="tech-device-independent-handlers">
         	<provisions>
            	<provision xref="tech-device-independent-handlers-1"/>
            </provisions>
         </checkpoint>
      </checkpoints>
 	</requirementInfo>
	
	<content>
		
		
		
		<test section="1">
			<procedure>
				<list>
					<item>Using the keyboard or an assistive technology that emulates the keyboard,
					navigate to the image and activate the ONCLICK event and the ONDBLCLICK event.</item>
				</list>
			</procedure>
			<testCode>
				<p><img id="star1" ondblclick="imgChange('../images/starPink.gif')" onclick="imgChange('../images/starRed.gif')" src="../images/starYel.gif" width="35" height="35" alt="star" border="0" name="star1"/>
				</p>
			</testCode>
      	<exResults>
				<list>
					<item>Image changes to a red star on single-click keyboard command</item>
					<item>Image changes to a pink star on double-click keyboard command</item>					
				</list>
			</exResults>
			<sourcescript>
					function imgChange( img ) 
					{
   					document.star1.src = img
					}			
			</sourcescript>
		</test>
		
		<test section="2">
			<procedure>
				<list>
					<item>Using the keyboard or an assistive technology that emulates the keyboard, navigate to the text input box.</item>
					<item>Using the keyboard or an assistive technology that emulates the keyboard, clear the text input box with ONCLICK.</item>					
				</list>
			</procedure>
			<testCode>
				<form action="../action/return.html" method="get">
					<input onclick="clearText(this)" value="Click here to clear text" name="text1"/> 
				</form>			
			</testCode>
      	<exResults>
				<list>
					<item>Text in input box is cleared</item>
				</list>
			</exResults>
			<sourcescript>
					function clearText(thefield)
					{
						if (thefield.defaultValue == thefield.value)
										thefield.value = ""
      				else thefield.value = thefield.defaultValue
					} 						
			</sourcescript>
		</test>
		
		<test section="3">
			<procedure>
				<list>
					<item>Using the keyboard or an assistive technology that emulates the keyboard, navigate to the text input box.</item>
					<item>Using the keyboard or an assistive technology that emulates the keyboard, activate the ONDBLCLICK function associated with the text input box.</item>					
				</list>
			</procedure>
			<testCode>
				<form action="../action/return.html" method="get">
					<label for="text1">Double-click on the text box to show the message:&nbsp;</label> 
					<input id="text1" ondblclick="showText(this)" name="text1"/>
				</form>
			</testCode>
      	<exResults>
				<list>
					<item>The text "Passes the Test" appears in the text box upon double-click</item>
				</list>
			</exResults>
			<sourcescript>
					function showText(thefield)
					{
						if (thefield.defaultValue == thefield.value)
										thefield.value = "Passed the test"
      				else
           					thefield.value = ""
					} 									
			</sourcescript>
		</test>				
						
	</content>

</testsuite>
