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 // The min-width/min-height includes padding and border and width/height doe s not include padding and border. | |
53 // 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). | |
54 // Hence the condition check here for values which are lesser than original value by 6px. | |
55 if (type == "fixed") { | |
56 if ((draggable.style.width == "194px") && (draggable.style.height == "19 4px")) | |
57 log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
58 else | |
59 log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
60 } else if (type == "relative-viewport") { | |
61 if ((draggable.style.width == "114px") && (draggable.style.height == "84 px")) | |
62 log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
63 else | |
64 log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
65 } else { | |
66 if ((draggable.style.width == "74px") && (draggable.style.height == "74p x")) | |
67 log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
68 else | |
69 log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height); | |
Julien - ping for review
2014/04/29 22:13:54
FYI we have a framework that does exactly what you
harpreet.sk
2014/04/30 10:12:53
Done.
| |
70 } | |
71 | |
72 } | |
73 </script> | |
74 </head> | |
75 <body onload="updateSize()"> | |
76 <div style="width:800px; height:800px"> | |
Julien - ping for review
2014/04/29 22:13:54
It's missing a description for what the test is te
harpreet.sk
2014/04/30 10:12:53
Description and expected result added in all layou
| |
77 <textarea id="textInputID"> | |
78 Some text | |
79 </textarea> | |
80 </div> | |
81 <pre id="console"></pre> | |
82 </body> | |
83 </html> | |
OLD | NEW |