--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/framework/wheel/NIST_click_001.html Fri Sep 19 04:01:46 2008 +0900
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <!-- Test Name: NIST_click-001 -->
+ <!-- Purpose - Evaluate a simulated click event over a table element -->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title>DOM Events API Test Suite - NIST_click_001</title>
+ <style type = "text/css">
+ #result:after {
+ display: block;
+ }
+ .not_yet_tested:after {
+ background-color: yellow;
+ content: "Not yet tested";
+ }
+ .failed:after {
+ background-color: red;
+ content: "Failed";
+ }
+ .passed:after {
+ background-color: green;
+ content: "Passed";
+ }
+ </style>
+ <script type="text/javascript">
+ // Function to begin the test.
+ function w3c_beginTest() {
+ if ("NIST_beginTest" in window) {
+ NIST_beginTest();
+ }
+ w3c_addEventListener();
+ }
+
+ // Function to report test result.
+
+ function w3c_reportResult(passed) {
+ if ("NIST_reportResult" in window) {
+ NIST_reportResult();
+ }
+ }
+
+ // Function to be executed in reaction to click event.
+ function w3c_reactToClick() {
+ var evt = document.createEvent("MouseEvent");
+ evt.initMouseEvent("click", true, true, window,0, 5, 0, 0, 0, true, true, true, true, 0, null);
+ document.dispatchEvent(evt);
+ _actualResults = evt.screenX;
+ _expectedResults = getExpectedResults();
+ w3c_removeEventListener();
+ w3c_reportResult();
+ }
+
+ function getExpectedResults()
+ {
+ return 5;
+ }
+
+ // Function to be executed in reaction to a click removal.
+ function w3c_reactToClickRemoval() {
+ }
+
+ // Function to add a listener to the element.
+ function w3c_addEventListener() {
+ var e1 = document.getElementById("tb1");
+ if (document.addEventListener) {
+ e1.addEventListener("click", w3c_reactToClick(), false);
+ }
+ else {
+ e1.attachEvent("on"+"mouseover", w3c_reactToMouseover());
+ }
+ }
+
+ // Function to remove a listener from the element.
+ function w3c_removeEventListener() {
+ var e1 = document.getElementById("tb1");
+ if (document.removeEventListener) {
+ e1.removeEventListener("click", w3c_reactToClickRemoval(), false);
+ } else {
+ e1.detachEvent("on"+"click", w3c_reactToClickRemoval(),false);
+ }
+ }
+ </script>
+ <script type="text/javascript" src="NIST_functions.js"></script>
+ </head>
+ <body onload="w3c_beginTest();">
+ <h3>Evaluate a simulated click event over a table element</h3>
+ <table id="tb1">
+ <tr><td id="t1">Row 1, Cell 1</td><td id="t6">Row 1, Cell 2</td></tr>
+ <tr><td id="t2">Row 2, Cell 1</td><td id="t7">Row 2, Cell 2</td></tr>
+ <tr><td id="t3">Row 3, Cell 1</td><td id="t8">Row 3, Cell 2</td></tr>
+ <tr><td id="t4">Row 4, Cell 1</td><td id="t9">Row 4, Cell 2</td></tr>
+ <tr><td id="t5">Row 5, Cell 1</td><td id="t10">Row 5, Cell 2</td></tr>
+ </table>
+ <div id="result" class="not_yet_tested"></div>
+ </body>
+</html>
\ No newline at end of file