| 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 month input type with mouse events'); | 37 description('Multiple fields UI of month input type with mouse events'); |
| 38 var input = document.getElementById('input'); | 38 var input = document.getElementById('input'); |
| 39 | 39 |
| 40 input.value = '2345-07'; | 40 input.value = '2345-07'; |
| 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(16, center); | 46 mouseClickOn(16, center); |
| 47 keyDown('upArrow'); | 47 keyDown('ArrowUp'); |
| 48 shouldBeEqualToString('input.value', '2345-08'); | 48 shouldBeEqualToString('input.value', '2345-08'); |
| 49 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); | 49 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); |
| 50 shouldBeEqualToString('input.value', '2345-09'); | 50 shouldBeEqualToString('input.value', '2345-09'); |
| 51 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); | 51 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); |
| 52 shouldBeEqualToString('input.value', '2345-08'); | 52 shouldBeEqualToString('input.value', '2345-08'); |
| 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 year field.'); | 56 debug('==> Focus on the year field.'); |
| 57 mouseClickOn(170, center); | 57 mouseClickOn(170, center); |
| 58 keyDown('upArrow'); | 58 keyDown('ArrowUp'); |
| 59 shouldBeEqualToString('input.value', '2346-08'); | 59 shouldBeEqualToString('input.value', '2346-08'); |
| 60 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); | 60 mouseClickOn(input.offsetWidth - spinButtonOffset, center - 1); |
| 61 shouldBeEqualToString('input.value', '2347-08'); | 61 shouldBeEqualToString('input.value', '2347-08'); |
| 62 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); | 62 mouseClickOn(input.offsetWidth - spinButtonOffset, center + 1); |
| 63 shouldBeEqualToString('input.value', '2346-08'); | 63 shouldBeEqualToString('input.value', '2346-08'); |
| 64 shouldBeZero('window.getSelection().rangeCount'); // No text selection. | 64 shouldBeZero('window.getSelection().rangeCount'); // No text selection. |
| 65 | 65 |
| 66 debug(''); | 66 debug(''); |
| 67 debug('==> Click on a disabled field.'); | 67 debug('==> Click on a disabled field.'); |
| 68 input.disabled = true; | 68 input.disabled = true; |
| 69 mouseClickOn(100, center); | 69 mouseClickOn(100, center); |
| 70 keyDown('upArrow'); | 70 keyDown('ArrowUp'); |
| 71 shouldBeEqualToString('input.value', '2346-08'); | 71 shouldBeEqualToString('input.value', '2346-08'); |
| 72 input.disabled = false; | 72 input.disabled = false; |
| 73 | 73 |
| 74 debug(''); | 74 debug(''); |
| 75 debug('==> Click on a read-only field.'); | 75 debug('==> Click on a read-only field.'); |
| 76 input.readOnly = true; | 76 input.readOnly = true; |
| 77 mouseClickOn(12, center); | 77 mouseClickOn(12, center); |
| 78 keyDown('upArrow'); | 78 keyDown('ArrowUp'); |
| 79 shouldBeEqualToString('input.value', '2346-08'); | 79 shouldBeEqualToString('input.value', '2346-08'); |
| 80 input.readOnly = false; | 80 input.readOnly = false; |
| 81 | 81 |
| 82 debug(''); | 82 debug(''); |
| 83 debug('==> Click on clear button.'); | 83 debug('==> Click on clear button.'); |
| 84 input.readOnly = true; | 84 input.readOnly = true; |
| 85 mouseClickOn(input.offsetWidth - clearButtonOffset, center); | 85 mouseClickOn(input.offsetWidth - clearButtonOffset, center); |
| 86 shouldBeEqualToString('input.value', '2346-08'); // Not changed. | 86 shouldBeEqualToString('input.value', '2346-08'); // Not changed. |
| 87 input.disabled = true; | 87 input.disabled = true; |
| 88 input.readOnly = false; | 88 input.readOnly = false; |
| 89 mouseClickOn(input.offsetWidth - clearButtonOffset, center); | 89 mouseClickOn(input.offsetWidth - clearButtonOffset, center); |
| 90 shouldBeEqualToString('input.value', '2346-08'); // Not changed. | 90 shouldBeEqualToString('input.value', '2346-08'); // Not changed. |
| 91 input.disabled = false; | 91 input.disabled = false; |
| 92 mouseClickOn(input.offsetWidth - clearButtonOffset, center); | 92 mouseClickOn(input.offsetWidth - clearButtonOffset, center); |
| 93 shouldBeEqualToString('input.value', ''); | 93 shouldBeEqualToString('input.value', ''); |
| 94 | 94 |
| 95 debug(''); | 95 debug(''); |
| 96 }; | 96 }; |
| 97 </script> | 97 </script> |
| 98 </body> | 98 </body> |
| 99 </html> | 99 </html> |
| OLD | NEW |