blob: 2d7d1eaf417c1fb4848ab2d5565e8e63c7851029 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/accessibility-helper.js"></script>
<script src="../resources/js-test.js"></script>
</head>
<body>
<div id="container" role="group">
<p>Content before main.</p>
<main>
<h1>No style changes</h1>
<div role="toolbar">
<div>
<button>Foo</button>
</div>
</div>
<h1>display: contents; on the toolbar</h1>
<div role="toolbar" style="display: contents;">
<div>
<button>Foo</button>
</div>
</div>
<h1>display: contents; on the generic div</h1>
<div role="toolbar">
<div style="display: contents;">
<button>Foo</button>
</div>
</div>
<h1>display: contents; on the button</h1>
<div role="toolbar">
<div>
<button style="display: contents;">Foo</button>
</div>
</div>
</main>
<p>Content after main.</p>
</div>
<script>
var testOutput = "This test ensures we can traverse through basic webpages with multiple display: contents elements via search.\n";
if (window.accessibilityController) {
const containerElement = accessibilityController.accessibleElementById("container");
let elementCount = 0;
let searchResult = null;
while (true) {
searchResult = containerElement.uiElementForSearchPredicate(searchResult, true, "AXAnyTypeSearchKey", "", false);
if (!searchResult)
break;
const role = searchResult.role;
testOutput += `\n${role}`;
if (role.includes("StaticText")) {
let textContent = accessibilityController.platformName === "ios" ? searchResult.description : searchResult.stringValue;
testOutput += `\n${textContent}`;
}
testOutput += "\n";
elementCount += 1;
}
testOutput += `\nTraversed ${elementCount} elements.`;
document.getElementById("container").style.visibility = "hidden";
debug(testOutput);
}
</script>
</body>
</html>