haikuwebkit/LayoutTests/accessibility/mac/attributed-string/attributed-string-for-range...

42 lines
1.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script>
var successfullyParsed = false;
</script>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="content" contenteditable>
word mispelled word
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This test ensures that attributed string for text marker range works and only includes misspelled attribute when requested.");
var text = 0;
var expectedOne = "AXFont - {\n AXFontFamily = Times;\n AXFontName = \"Times-Roman\";\n AXFontSize = 16;\n AXVisibleName = \"Times Roman\";\n}, word mispelled word";
var expectedTwo = "AXFont - {\n AXFontFamily = Times;\n AXFontName = \"Times-Roman\";\n AXFontSize = 16;\n AXVisibleName = \"Times Roman\";\n}, Misspelled, AXFont - {\n AXFontFamily = Times;\n AXFontName = \"Times-Roman\";\n AXFontSize = 16;\n AXVisibleName = \"Times Roman\";\n}, AXFont - {\n AXFontFamily = Times;\n AXFontName = \"Times-Roman\";\n AXFontSize = 16;\n AXVisibleName = \"Times Roman\";\n}, word mispelled word";
if (window.accessibilityController) {
var obj = accessibilityController.accessibleElementById("content");
var range = obj.textMarkerRangeForElement(obj)
text = obj.attributedStringForTextMarkerRangeWithOptions(range, false);
shouldBe("text", "expectedOne");
text = obj.attributedStringForTextMarkerRangeWithOptions(range, true);
shouldBe("text", "expectedTwo");
}
successfullyParsed = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>