blob: f5da7147655a3ccfbd9183a1e54a68a8e1c6906a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests find for strings with soft hyphens in them.");
function canFind(target, specimen)
{
getSelection().empty();
var textNode = document.createTextNode(specimen);
document.body.appendChild(textNode);
document.execCommand("FindString", false, target);
var result = getSelection().rangeCount != 0;
getSelection().empty();
document.body.removeChild(textNode);
return result;
}
document.getElementById("console").style.display = "none";
var hyphen= String.fromCharCode(0x2010);
var softHyphen = String.fromCharCode(0x00AD);
shouldBe('canFind("ab", "a" + softHyphen + "b")', 'true');
shouldBe('canFind("ab", "a" + softHyphen + softHyphen + "b")', 'true');
shouldBe('canFind("a\u0300b", "a" + softHyphen + "b")', 'false');
shouldBe('canFind("ab", "a" + softHyphen + "\u0300b")', 'true');
shouldBe('canFind("ab", "a\u0300" + softHyphen + "b")', 'true');
shouldBe('canFind("a" + softHyphen + "b", "a" + softHyphen + "b")', 'true');
shouldBe('canFind("a" + softHyphen + "b", "ab")', 'true');
// Soft hyphen doesn't match hyphen and hyphen-minus.
shouldBe('canFind("a" + hyphen + "b", "a" + softHyphen + "b")', 'false');
shouldBe('canFind("a-b", "a" + softHyphen + "b")', 'false');
document.getElementById("console").style.removeProperty("display");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>