2010-11-30 Daniel Bates <dbates@rim.com>
[WebKit-https.git] / LayoutTests / fast / events / check-defocus-event-order-when-triggered-by-tab.html
1 <html>
2 <head>
3 <link rel="stylesheet" href="../js/resources/js-test-style.css">
4 <script src="../js/resources/js-test-pre.js"></script>
5 <script src="resources/record-events.js"></script>
6 <script>
7 if (window.layoutTestController)
8     layoutTestController.dumpAsText();
9
10 window.onload = runTest;
11
12 function runTest()
13 {
14     if (!window.eventSender)
15         return;
16
17     var firstInput = document.getElementById("firstInput");
18     var secondInput = document.getElementById("secondInput");
19     registerElementsAndEventsToRecord([firstInput, secondInput], ["focus", "blur", "change", "click"]);
20
21     beginRecordingEvents();
22     firstInput.focus();
23     eventSender.keyDown("A");
24     eventSender.keyDown("\t"); // Transfers focus to text field "second input".
25     endRecordingEvents();
26     checkThatEventsFiredInOrder([["firstInput", "focus"], ["firstInput", "change"], ["firstInput", "blur"], ["secondInput", "focus"]]);
27     debug('<br /><span class="pass">TEST COMPLETE</span>');
28 }
29 </script>
30 </head>
31 <body>
32 <p id="description"></p>
33 <div id="test-container">
34     <input type="text" id="firstInput" placeholder="first input" />
35     <input type="text" id="secondInput" placeholder="second input" />
36 </div>
37 <div id="console"></div>
38 <script>
39     description("This test checks that when a user focuses on the &quot;first input&quot; text field, modifies its contents, and then " +
40                 "defocuses it by pressing the tab key that the following DOM events are fired in order: Focus, Change, Blur, Focus " +
41                 "(on &quot;second input&quot;). Note, this test must be run by Dump Render Tree.");
42     var successfullyParsed = true;
43 </script>
44 </body>
45 </html>