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