mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 01:08:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
102
layout/forms/test/test_textarea_resize.html
Normal file
102
layout/forms/test/test_textarea_resize.html
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 477700</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<textarea id="textarea" style="-moz-appearance: none; border: 2px solid black; padding: 3px; box-sizing: border-box; min-width: 15px; min-height: 15px;">Text</textarea>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for textbox resizing **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(() => SimpleTest.executeSoon(doTheTest));
|
||||
|
||||
// -1 means use the default value which is 'both', then test explicitly
|
||||
// setting each possible value.
|
||||
var currentResize = -1;
|
||||
var currentBoxSizing = 0;
|
||||
var currentPointer = 0;
|
||||
var resizeTypes = [ "horizontal", "vertical", "none", "inherit", "both" ];
|
||||
var boxSizingTypes = [ "", "border-box" ];
|
||||
var pointerTypes = [ synthesizeMouse, synthesizeTouch]
|
||||
|
||||
function doTheTest() {
|
||||
runTest(pointerTypes[currentPointer]);
|
||||
}
|
||||
|
||||
function runTest(aPointerFunc) {
|
||||
var boxSizingText = " with box sizing " + (currentBoxSizing ? boxSizingTypes[currentBoxSizing] : "content-box");
|
||||
|
||||
var textarea = $("textarea");
|
||||
var rect = textarea.getBoundingClientRect();
|
||||
var touch = aPointerFunc.name.match(/Touch/);
|
||||
// -1 means use the default value of resize, i.e. "both"
|
||||
var type = (currentResize == -1) ? "both" : resizeTypes[currentResize];
|
||||
// assume that the resizer is in the lower right corner
|
||||
|
||||
aPointerFunc(textarea, rect.width - 10, rect.height - 10, { type: touch ? "touchstart" : "mousedown" });
|
||||
aPointerFunc(textarea, rect.width + 40, rect.height + 40, { type: touch ? "touchmove" : "mousemove" });
|
||||
|
||||
var newrect = textarea.getBoundingClientRect();
|
||||
var hchange = (type == "both" || type == "horizontal");
|
||||
var vchange = (type == "both" || type == "vertical");
|
||||
|
||||
is(Math.round(newrect.width), Math.round(rect.width + (hchange ? 50 : 0)),
|
||||
type + " width has increased" + boxSizingText + " using " + aPointerFunc.name);
|
||||
is(Math.round(newrect.height), Math.round(rect.height + (vchange ? 50 : 0)),
|
||||
type + " height has increased" + boxSizingText + " using " + aPointerFunc.name);
|
||||
|
||||
aPointerFunc(textarea, rect.width - 20, rect.height - 20, { type: touch ? "touchmove" : "mousemove" });
|
||||
|
||||
newrect = textarea.getBoundingClientRect();
|
||||
|
||||
is(Math.round(newrect.width), Math.round(rect.width - (hchange ? 10 : 0)),
|
||||
type + " width has decreased" + boxSizingText + " using " + aPointerFunc.name);
|
||||
is(Math.round(newrect.height), Math.round(rect.height - (vchange ? 10 : 0)),
|
||||
type + " height has decreased" + boxSizingText + " using " + aPointerFunc.name);
|
||||
|
||||
aPointerFunc(textarea, rect.width - 220, rect.height - 220, { type: touch ? "touchmove" : "mousemove" });
|
||||
|
||||
newrect = textarea.getBoundingClientRect();
|
||||
ok(hchange ? newrect.width >= 15 : Math.round(newrect.width) == Math.round(rect.width),
|
||||
type + " width decreased below minimum" + boxSizingText + " using " + newrect.width);
|
||||
ok(vchange ? newrect.height >= 15 : Math.round(newrect.height) == Math.round(rect.height),
|
||||
type + " height decreased below minimum" + boxSizingText + " using " + aPointerFunc.name);
|
||||
|
||||
aPointerFunc(textarea, rect.width - 8, rect.height - 8, { type: touch ? "touchend" : "mouseup" });
|
||||
|
||||
textarea.style.width = "auto";
|
||||
textarea.style.height = "auto";
|
||||
|
||||
if (currentBoxSizing++ <= boxSizingTypes.length) {
|
||||
textarea.style.MozBoxSizing = boxSizingTypes[currentBoxSizing];
|
||||
SimpleTest.executeSoon(doTheTest);
|
||||
} else {
|
||||
currentBoxSizing = 0;
|
||||
if (++currentResize < resizeTypes.length) {
|
||||
textarea.style.resize = resizeTypes[currentResize];
|
||||
SimpleTest.executeSoon(doTheTest);
|
||||
} else {
|
||||
currentResize = -1;
|
||||
textarea.style.resize = "";
|
||||
if (++currentPointer < pointerTypes.length) {
|
||||
SimpleTest.executeSoon(doTheTest);
|
||||
} else {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue