| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/ahem.js"></script> | 4 <script src="../../../resources/ahem.js"></script> |
| 5 <script src="../../../resources/js-test.js"></script> | 5 <script src="../../../resources/js-test.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <p id="description"></p> | 8 <p id="description"></p> |
| 9 <p> | 9 <p> |
| 10 Please run this with DRT or WTR. | 10 Please run this with DRT or WTR. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 description('Multiple fields UI of date input type with mouse events'); | 37 description('Multiple fields UI of date input type with mouse events'); |
| 38 var input = document.getElementById('input'); | 38 var input = document.getElementById('input'); |
| 39 | 39 |
| 40 input.value = '2345-07-19'; | 40 input.value = '2345-07-19'; |
| 41 var center = input.offsetHeight / 2; | 41 var center = input.offsetHeight / 2; |
| 42 var spinButtonOffset = 26; | 42 var spinButtonOffset = 26; |
| 43 var clearButtonOffset = 41; | 43 var clearButtonOffset = 41; |
| 44 | 44 |
| 45 debug('==> Focus on the month field.'); | 45 debug('==> Focus on the month field.'); |
| 46 mouseClickOn(12, center); | 46 mouseClickOn(12, center); |
| 47 keyDown('upArrow'); | 47 keyDown('ArrowUp'); |
| 48 shouldBeEqualToString('input.value', '2345-08-19'); | 48 shouldBeEqualToString('input.value', '2345-08-19'); |
| 49 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); | 49 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); |
| 50 shouldBeEqualToString('input.value', '2345-09-19'); | 50 shouldBeEqualToString('input.value', '2345-09-19'); |
| 51 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); | 51 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); |
| 52 shouldBeEqualToString('input.value', '2345-08-19'); | 52 shouldBeEqualToString('input.value', '2345-08-19'); |
| 53 shouldBeZero('window.getSelection().rangeCount'); // No text selection. | 53 shouldBeZero('window.getSelection().rangeCount'); // No text selection. |
| 54 | 54 |
| 55 debug(''); | 55 debug(''); |
| 56 debug('==> Focus on the day field.'); | 56 debug('==> Focus on the day field.'); |
| 57 mouseClickOn(60, center); | 57 mouseClickOn(60, center); |
| 58 keyDown('upArrow'); | 58 keyDown('ArrowUp'); |
| 59 shouldBeEqualToString('input.value', '2345-08-20'); | 59 shouldBeEqualToString('input.value', '2345-08-20'); |
| 60 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); | 60 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); |
| 61 shouldBeEqualToString('input.value', '2345-08-21'); | 61 shouldBeEqualToString('input.value', '2345-08-21'); |
| 62 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); | 62 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); |
| 63 shouldBeEqualToString('input.value', '2345-08-20'); | 63 shouldBeEqualToString('input.value', '2345-08-20'); |
| 64 shouldBeZero('window.getSelection().rangeCount'); // No text selection. | 64 shouldBeZero('window.getSelection().rangeCount'); // No text selection. |
| 65 | 65 |
| 66 debug(''); | 66 debug(''); |
| 67 debug('==> Focus on the year field.'); | 67 debug('==> Focus on the year field.'); |
| 68 mouseClickOn(input.offsetWidth - 115, center); | 68 mouseClickOn(input.offsetWidth - 115, center); |
| 69 keyDown('upArrow'); | 69 keyDown('ArrowUp'); |
| 70 shouldBeEqualToString('input.value', '2346-08-20'); | 70 shouldBeEqualToString('input.value', '2346-08-20'); |
| 71 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); | 71 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); |
| 72 shouldBeEqualToString('input.value', '2347-08-20'); | 72 shouldBeEqualToString('input.value', '2347-08-20'); |
| 73 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); | 73 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); |
| 74 shouldBeEqualToString('input.value', '2346-08-20'); | 74 shouldBeEqualToString('input.value', '2346-08-20'); |
| 75 shouldBeZero('window.getSelection().rangeCount'); // No text selection. | 75 shouldBeZero('window.getSelection().rangeCount'); // No text selection. |
| 76 | 76 |
| 77 debug(''); | 77 debug(''); |
| 78 debug('==> Click on a disabled field.'); | 78 debug('==> Click on a disabled field.'); |
| 79 input.disabled = true; | 79 input.disabled = true; |
| 80 mouseClickOn(12, center); | 80 mouseClickOn(12, center); |
| 81 keyDown('upArrow'); | 81 keyDown('ArrowUp'); |
| 82 shouldBeEqualToString('input.value', '2346-08-20'); | 82 shouldBeEqualToString('input.value', '2346-08-20'); |
| 83 input.disabled = false; | 83 input.disabled = false; |
| 84 | 84 |
| 85 debug(''); | 85 debug(''); |
| 86 debug('==> Click on a read-only field.'); | 86 debug('==> Click on a read-only field.'); |
| 87 input.readOnly = true; | 87 input.readOnly = true; |
| 88 mouseClickOn(12, center); | 88 mouseClickOn(12, center); |
| 89 keyDown('upArrow'); | 89 keyDown('ArrowUp'); |
| 90 shouldBeEqualToString('input.value', '2346-08-20'); | 90 shouldBeEqualToString('input.value', '2346-08-20'); |
| 91 input.readOnly = false; | 91 input.readOnly = false; |
| 92 | 92 |
| 93 debug(''); | 93 debug(''); |
| 94 debug('==> Click on clear button.'); | 94 debug('==> Click on clear button.'); |
| 95 input.readOnly = true; | 95 input.readOnly = true; |
| 96 mouseClickOn(input.offsetWidth - clearButtonOffset, center); | 96 mouseClickOn(input.offsetWidth - clearButtonOffset, center); |
| 97 shouldBeEqualToString('input.value', '2346-08-20'); | 97 shouldBeEqualToString('input.value', '2346-08-20'); |
| 98 input.disabled = true; | 98 input.disabled = true; |
| 99 input.readOnly = false; | 99 input.readOnly = false; |
| 100 mouseClickOn(input.offsetWidth - clearButtonOffset, center); | 100 mouseClickOn(input.offsetWidth - clearButtonOffset, center); |
| 101 shouldBeEqualToString('input.value', '2346-08-20'); | 101 shouldBeEqualToString('input.value', '2346-08-20'); |
| 102 input.disabled = false; | 102 input.disabled = false; |
| 103 mouseClickOn(input.offsetWidth - clearButtonOffset, center); | 103 mouseClickOn(input.offsetWidth - clearButtonOffset, center); |
| 104 shouldBeEqualToString('input.value', ''); | 104 shouldBeEqualToString('input.value', ''); |
| 105 | 105 |
| 106 debug(''); | 106 debug(''); |
| 107 }; | 107 }; |
| 108 </script> | 108 </script> |
| 109 </body> | 109 </body> |
| 110 </html> | 110 </html> |
| OLD | NEW |