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 updateSize() | |
11 { | |
12 if (window.testRunner) { | |
13 testRunner.dumpAsText(); | |
14 | |
15 var textAreaElement = document.getElementById("textInputID"); | |
16 | |
17 textAreaElement.style.width = "400px"; | |
18 textAreaElement.style.height = "400px"; | |
19 textAreaElement.style.minWidth="200px"; | |
20 textAreaElement.style.minHeight="200px"; | |
21 testDragAndMove("fixed"); | |
22 | |
23 textAreaElement.style.width = "400px"; | |
24 textAreaElement.style.height = "400px"; | |
25 textAreaElement.style.minWidth="15vw"; | |
26 textAreaElement.style.minHeight="15vh"; | |
27 testDragAndMove("relative-viewport"); | |
28 | |
29 textAreaElement.style.width = "400px"; | |
30 textAreaElement.style.height = "400px"; | |
31 textAreaElement.style.minWidth="10%"; | |
32 textAreaElement.style.minHeight="10%"; | |
33 testDragAndMove("percentage"); | |
34 | |
35 } else | |
36 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"); | |
37 } | |
38 | |
39 function testDragAndMove(type) | |
40 { | |
41 var draggable = document.getElementById("textInputID"); | |
42 var startX = draggable.offsetLeft + 400; | |
43 var startY = draggable.offsetTop + 400; | |
44 | |
45 eventSender.dragMode = false; | |
46 eventSender.mouseMoveTo(startX,startY); | |
47 eventSender.mouseDown(); | |
48 // Then drag it. | |
49 eventSender.mouseMoveTo(startX - 350, startY - 350); | |
50 eventSender.mouseUp(); | |
51 | |
52 if (type == "fixed") { | |
53 if ((draggable.style.width == "194px") && (draggable.style.height == "19 4px")) | |
harpreet.sk
2014/04/24 15:28:27
The condition check here for 194px and not 200px a
Julien - ping for review
2014/04/24 21:49:05
I expect that we need the borders to delimit the t
harpreet.sk
2014/04/25 13:33:48
Comment added.
| |
54 log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
55 else | |
56 log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
57 } else if (type == "relative-viewport") { | |
58 if ((draggable.style.width == "114px") && (draggable.style.height == "84 px")) | |
harpreet.sk
2014/04/24 15:28:27
Ideally for this case (viewport-length) the width
| |
59 log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
60 else | |
61 log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
62 } else { | |
63 if ((draggable.style.width == "74px") && (draggable.style.height == "74p x")) | |
harpreet.sk
2014/04/24 15:28:27
min-width/min-height includes padding and border s
| |
64 log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
65 else | |
66 log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
67 } | |
68 | |
69 } | |
70 </script> | |
71 </head> | |
72 <body onload="updateSize()"> | |
73 <div style="width:800px; height:800px"> | |
74 <textarea id="textInputID"> | |
75 Some text | |
76 </textarea> | |
77 </div> | |
78 <pre id="console"></pre> | |
79 </body> | |
80 </html> | |
OLD | NEW |