Tests for bug 1169267

This commit is contained in:
Simon Montagu 2015-06-01 18:31:43 +03:00
parent 51db4dd1e8
commit 653e06c529
8 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test bug 1169267</title>
<style>
textarea { resize: none; }
</style>
</head>
<body>
<div><input type="text" dir="rtl" value="123אבג"></div>
<div><span dir="rtl">123אבג</span></div>
<div><textarea dir="rtl">123אבג</textarea></div>
<div><button dir="rtl">123אבג</button></div>
<div><bdi dir="rtl">123אבג</bdi></div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test bug 1169267</title>
<script type="text/javascript" src="setDir.js"></script>
<style>
textarea { resize: none; }
</style>
</head>
<body onload="appendTextFromArray(new Array('123', 'אבג'))">
<div><input type="text" id="set0" dir="auto"></div>
<div><span id="set1" dir="auto"></span></div>
<div><textarea id="set2" dir="auto"></textarea></div>
<div><button id="set3" dir="auto"></button></div>
<div><bdi id="set4"></bdi></div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test bug 1169267</title>
<script type="text/javascript" src="setDir.js"></script>
<style>
textarea { resize: none; }
</style>
</head>
<body onload="appendDeleteAppendTextFromArray(new Array('123', 'אבג', 'אבג'))">
<div><input type="text" id="set0" dir="auto"></div>
<div><span id="set1" dir="auto"></span></div>
<div><textarea id="set2" dir="auto"></textarea></div>
<div><button id="set3" dir="auto"></button></div>
<div><bdi id="set4"></bdi></div>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test bug 1169267</title>
<style>
textarea { resize: none; }
</style>
</head>
<body>
<div><input type="text" dir="rtl" value="456גדה"></div>
<div><span dir="rtl">456גדה</span></div>
<div><textarea dir="rtl">456גדה</textarea></div>
<div><button dir="rtl">456גדה</button></div>
<div><bdi dir="rtl">456גדה</bdi></div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test bug 1169267</title>
<script type="text/javascript" src="setDir.js"></script>
<style>
textarea { resize: none; }
</style>
</head>
<body onload="appendTextFromArray(new Array('456', 'גדה'))">
<div><input type="text" id="set0" dir="auto"></div>
<div><span id="set1" dir="auto"></span></div>
<div><textarea id="set2" dir="auto"></textarea></div>
<div><button id="set3" dir="auto"></button></div>
<div><bdi id="set4"></bdi></div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test bug 1169267</title>
<script type="text/javascript" src="setDir.js"></script>
<style>
textarea { resize: none; }
</style>
</head>
<body onload="appendDeleteAppendTextFromArray(new Array('456', 'def', 'גדה'))">
<div><input type="text" id="set0" dir="auto"></div>
<div><span id="set1" dir="auto"></span></div>
<div><textarea id="set2" dir="auto"></textarea></div>
<div><button id="set3" dir="auto"></button></div>
<div><bdi id="set4"></bdi></div>
</body>
</html>

View File

@ -113,3 +113,7 @@ fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated&&!azur
== 859093-1.html 859093-1-ref.html
== 889742-1.html 889742-1-ref.html
== 1103348-1.html 1103348-1-ref.html
== 1169267-delete-add-1a.html 1169267-delete-add-1-ref.html
== 1169267-delete-add-1b.html 1169267-delete-add-1-ref.html
== 1169267-delete-add-2a.html 1169267-delete-add-2-ref.html
== 1169267-delete-add-2b.html 1169267-delete-add-2-ref.html

View File

@ -125,6 +125,54 @@ function appendTextFromArray(textArray)
}
}
// Add the members of the array to the text content of the elements in
// the document, not including the last member. Then delete the last but
// one and add the last one
// Useful for testing scenarios like bug 1169267
function appendDeleteAppendTextFromArray(textArray)
{
if (textArray.length < 2) {
return;
}
for (var i = 0; ; ++i) {
theElement = document.getElementById("set" + i);
if (!theElement) {
break;
}
var isInput = (theElement.tagName == "INPUT");
if (!isInput) {
var textNode = document.createTextNode("");
theElement.appendChild(textNode);
}
for (var j = 0; j < textArray.length - 1; ++j) {
if (isInput) {
theElement.value += textArray[j];
} else {
textNode.appendData(textArray[j]);
}
}
// delete the last element added
var deleteElt = textArray[textArray.length - 2];
if (isInput) {
theElement.value = theElement.value.slice(0, -deleteElt.length);
} else {
textNode.deleteData(textNode.length - deleteElt.length,
deleteElt.length);
}
// add the next element
var addElt = textArray[textArray.length - 1];
if (isInput) {
theElement.value += addElt;
} else {
textNode.appendData(addElt);
}
}
}
function appendSpansFromArray(textArray)
{
for (var i = 0; ; ++i) {