Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Unified Diff: LayoutTests/fast/forms/textarea-resize-below-min-size-set.html

Issue 239983004: Textarea resize-able only to larger; min-height and min-width properly set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing the changes asked in patch set 4 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/forms/textarea-resize-below-min-size-set.html
diff --git a/LayoutTests/fast/forms/textarea-resize-below-min-size-set.html b/LayoutTests/fast/forms/textarea-resize-below-min-size-set.html
new file mode 100644
index 0000000000000000000000000000000000000000..0ae19e7258335a15940cd42336e6c49b25f0ee07
--- /dev/null
+++ b/LayoutTests/fast/forms/textarea-resize-below-min-size-set.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function log(msg)
+{
+ document.getElementById('console').appendChild(document.createTextNode(msg + '\n'));
+}
+
+function updateSize()
+{
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+
+ var textAreaElement = document.getElementById("textInputID");
+
+ textAreaElement.style.width = "400px";
+ textAreaElement.style.height = "400px";
+ textAreaElement.style.minWidth="200px";
+ textAreaElement.style.minHeight="200px";
+ testDragAndMove("fixed");
+
+ textAreaElement.style.width = "400px";
+ textAreaElement.style.height = "400px";
+ textAreaElement.style.minWidth="15vw";
+ textAreaElement.style.minHeight="15vh";
+ testDragAndMove("relative-viewport");
+
+ textAreaElement.style.width = "400px";
+ textAreaElement.style.height = "400px";
+ textAreaElement.style.minWidth="10%";
+ textAreaElement.style.minHeight="10%";
+ testDragAndMove("percentage");
+
+ } else
+ log("This test needs window.testRunner and window.eventSender to work. To manually test it, drag the textarea above. \nFor test to pass the width and height of textarea should not go below min-width and min-height");
+}
+
+function testDragAndMove(type)
+{
+ var draggable = document.getElementById("textInputID");
+ var startX = draggable.offsetLeft + 400;
+ var startY = draggable.offsetTop + 400;
+
+ eventSender.dragMode = false;
+ eventSender.mouseMoveTo(startX,startY);
+ eventSender.mouseDown();
+ // Then drag it.
+ eventSender.mouseMoveTo(startX - 350, startY - 350);
+ eventSender.mouseUp();
+
+ // The min-width/min-height includes padding and border and width/height does not include padding and border.
+ // 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).
+ // Hence the condition check here for values which are lesser than original value by 6px.
+ if (type == "fixed") {
+ if ((draggable.style.width == "194px") && (draggable.style.height == "194px"))
+ log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height);
+ else
+ log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height);
+ } else if (type == "relative-viewport") {
+ if ((draggable.style.width == "114px") && (draggable.style.height == "84px"))
+ log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height);
+ else
+ log("FAIL textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height);
+ } else {
+ if ((draggable.style.width == "74px") && (draggable.style.height == "74px"))
+ log("PASS textAreaElement width is " + draggable.style.width + " and height is " + draggable.style.height);
+ else
+ 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.
+ }
+
+}
+</script>
+</head>
+<body onload="updateSize()">
+<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
+<textarea id="textInputID">
+Some text
+</textarea>
+</div>
+<pre id="console"></pre>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698