f801a47aad3527bfd534c66373fc5ed4fa742e80
[WebKit-https.git] / LayoutTests / platform / chromium / fast / forms / calendar-picker / calendar-picker-mouse-operations.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../../../fast/js/resources/js-test-pre.js"></script>
5 <script src="../../../../../fast/forms/resources/common.js"></script>
6 <script src="../../../../../fast/forms/resources/picker-common.js"></script>
7 <script src="resources/calendar-picker-common.js"></script>
8 </head>
9 <body>
10 <p id="description"></p>
11 <div id="console"></div>
12 <input type=date id=date value="2000-01-02">
13 <script>
14 description("Tests if calendar picker key bindings work as expected.");
15
16 debug('Check that page popup doesn\'t exist at first.');
17 shouldBeNull('document.getElementById("mock-page-popup")');
18
19 openPicker(document.getElementById('date'), test);
20
21 function test() {
22     shouldBe('selectedDate()', '"2000-01-02"');
23     shouldBe('currentMonth()', '"2000-01"');
24
25     debug('Check that hovering over an entry highlights it.');
26     hoverOverElement(popupWindow.document.getElementsByClassName("day")[5]);
27     shouldBe('selectedDate()', '"1999-12-31"');
28     shouldBe('currentMonth()', '"2000-01"');
29
30     hoverOverElement(popupWindow.document.getElementsByClassName("day")[9]);
31     shouldBe('selectedDate()', '"2000-01-04"');
32     shouldBe('currentMonth()', '"2000-01"');
33
34     debug('Check that navigating between months maintains selection position.');
35     eventSender.keyDown('m');
36     shouldBe('selectedDate()', '"2000-02-08"');
37     shouldBe('currentMonth()', '"2000-02"');
38
39     debug('Check that moving the mouse outside the popup de-highlights entries.');
40     hoverOverElement(document.getElementById('description'));
41     shouldBeUndefined('selectedDate()');
42
43     debug('Check that mouse click closes the popup and sets the value.');
44     clickElement(popupWindow.document.getElementsByClassName("day")[6]);
45     shouldBeNull('document.getElementById("mock-page-popup")');
46     shouldBe('document.getElementById("date").value', '"2000-02-05"');
47
48     finishJSTest();
49 }
50 </script>
51 <script src="../../../../../fast/js/resources/js-test-post.js"></script>
52 </body>
53 </html>