| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <script src="../resources/accessibility-helper.js"></script> |
| <script src="../resources/js-test.js"></script> |
| <div id="container" role="group"> |
| var testOutput = "This test ensures we can traverse through an object's children after its role is changed dynamically.\n"; |
| function traverse(containerElement) { |
| searchResult = containerElement.uiElementForSearchPredicate(searchResult, true, "AXAnyTypeSearchKey", "", false); |
| const role = searchResult.role; |
| testOutput += `\n${role}`; |
| if (role.includes("StaticText")) { |
| let textContent = accessibilityController.platformName === "ios" ? searchResult.description : searchResult.stringValue; |
| testOutput += `\n${textContent}`; |
| if (window.accessibilityController) { |
| window.jsTestIsAsync = true; |
| const container = accessibilityController.accessibleElementById("container"); |
| testOutput += "\nPerforming search traversal with initial page state.\n"; |
| document.getElementById("container").role = "main"; |
| setTimeout(async function() { |
| if (accessibilityController.platformName === "ios") |
| return container.role && container.role.includes("LandmarkMain"); |
| return container.subrole && container.subrole.includes("AXLandmarkMain"); |
| testOutput += "\nPerforming search traversal after role change.\n"; |
| document.getElementById("container").style.visibility = "hidden"; |