blob: a18a20b1a95a68ecd6d739069e80b82ca921810c [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<title>Select Text</title>
</head>
<body>
<p contenteditable="true" id="text">The Man jumped high.</p>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that find and replace will match the capitalization of the replaced word.");
if (window.accessibilityController) {
var text = accessibilityController.accessibleElementById("text");
document.getElementById("text").focus();
// 'Man' is capitalized, so the replaced text should end up capitalized.
var result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "man", "test");
shouldBe("document.getElementById('text').innerHTML", "'The&nbsp;Test&nbsp;jumped high.'");
// 'jumped' is not capitalized so the text should not be capitalized.
result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "jumped", "Test");
shouldBe("document.getElementById('text').innerHTML", "'The&nbsp;Test&nbsp;test&nbsp;high.'");
// The replacement text was all caps, so don't change based on the existing text.
result = text.selectTextWithCriteria("AXSelectTextAmbiguityResolutionClosestToSelection", "high", "TEST");
shouldBe("document.getElementById('text').innerHTML", "'The&nbsp;Test&nbsp;test&nbsp;TEST.'");
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>