39 lines
1.5 KiB
HTML
39 lines
1.5 KiB
HTML
<!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 Test 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 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>
|
|
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|