blob: 94414f0537a144d2d0ba1831ff913fa0226199e9 [file] [edit]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.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 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 Test 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 Test test TEST.'");
}
</script>
</body>
</html>