blob: 9220bc33ccb6eb86ef4855c65749f044c13ba159 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../resources/accessibility-helper.js"></script>
<script>
var successfullyParsed = false;
</script>
</head>
<style>
body {
font-family: ahem;
-webkit-font-smoothing: none;
}
</style>
<body id="body">
<div id="content" aria-label="test">
<summary>a<span>b<div>c</div>d</span>e</summary>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that we only insert valid children when building ax tree.");
jsTestIsAsync = true;
if ("webkitRequestFullScreen" in Element.prototype) {
var content = accessibilityController.accessibleElementById("content");
var value;
if (accessibilityController.platformName == "atk")
value = "AXValue: ab<\\n>c<\\n>de<\\n>";
else
value = "AXValue: d";
document.body.offsetTop;
var span = document.getElementsByTagName('span')[0];
var fullscreenChangeEvent = function(event) {
if (document.webkitIsFullScreen) {
setTimeout(function () {
document.webkitCancelFullScreen();
}, 0)
} else
finishJSTest();
shouldBe("valueOccuranceInElementTree(content, value)", "1");
};
document.addEventListener('webkitfullscreenchange', fullscreenChangeEvent);
document.addEventListener('keydown', function () {
span.webkitRequestFullScreen();
});
shouldBe("valueOccuranceInElementTree(content, value)", "1");
if (window.eventSender)
eventSender.keyDown('a');
function valueOccuranceInElementTree(element, value) {
if (!element) {
return 0;
}
var count = 0;
if (element.stringValue == value)
count++;
var childrenCount = element.childrenCount;
for (var k = 0; k < childrenCount; k++)
count += valueOccuranceInElementTree(element.childAtIndex(k), value);
return count;
}
}
successfullyParsed = true;
</script>
</body>
</html>