OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script> |
| 5 function log(msg) |
| 6 { |
| 7 document.getElementById('console').appendChild(document.createTextNode(msg +
'\n')); |
| 8 } |
| 9 |
| 10 function test() |
| 11 { |
| 12 if (window.testRunner) { |
| 13 testRunner.dumpAsText(); |
| 14 testDragAndMove(); |
| 15 } else |
| 16 log("This test needs window.testRunner and window.eventSender to work. T
o manually test it, drag the textarea above. \nFor test to pass the width and he
ight of textarea should not go below min-width and min-height"); |
| 17 } |
| 18 |
| 19 function testDragAndMove() |
| 20 { |
| 21 var draggable = document.getElementById("textInputID"); |
| 22 var startX = draggable.offsetLeft + 400; |
| 23 var startY = draggable.offsetTop + 400; |
| 24 |
| 25 eventSender.dragMode = false; |
| 26 eventSender.mouseMoveTo(startX,startY); |
| 27 eventSender.mouseDown(); |
| 28 // Then drag it. |
| 29 eventSender.mouseMoveTo(startX - 395, startY - 395); |
| 30 eventSender.mouseUp(); |
| 31 |
| 32 // The min-width/min-height includes padding and border and width/height doe
s not include padding and border. |
| 33 // So when we set say min-width = 200px it means actual minimum width of box
to be 194px (as 2px paddding and 1px border on all side). |
| 34 // Hence the condition check here for 9px as default minimum size for resizi
ng is 15x15. |
| 35 if ((draggable.style.width == "9px") && (draggable.style.height == "9px")) |
| 36 log("PASS textAreaElement width is " + draggable.style.width + " and hei
ght is " + draggable.style.height); |
| 37 else |
| 38 log("FAIL textAreaElement width is " + draggable.style.width + " and hei
ght is " + draggable.style.height); |
| 39 } |
| 40 </script> |
| 41 </head> |
| 42 <body onload="test()"> |
| 43 <textarea style="width:400px; height:400px" id="textInputID"> |
| 44 Some text |
| 45 </textarea> |
| 46 <pre id="console"></pre> |
| 47 </body> |
| 48 </html> |
OLD | NEW |