| <!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> |
| <button id="button-1" aria-labelledby="password-1">Button One</button> |
| <button id="button-2">Button Two</button> |
| <input type="password" id="password-1"> |
| <p id="text-1">Before password <input type="password" id="password-2">After password</p> |
| </div> |
| |
| <script> |
| let output = "This test ensures a label from aria-labelledby does not include a password inputs value.\n\n"; |
| if (window.accessibilityController) { |
| window.jsTestIsAsync = true; |
| |
| var button1 = accessibilityController.accessibleElementById("button-1"); |
| var button2 = accessibilityController.accessibleElementById("button-2"); |
| var password1 = accessibilityController.accessibleElementById("password-1"); |
| var password2 = accessibilityController.accessibleElementById("password-2"); |
| output += expect("button1.description", "'AXDescription: '"); |
| output += expect("button1.title", "'AXTitle: Button One'"); |
| |
| document.getElementById("password-1").value = "hello"; |
| setTimeout(async function() { |
| await waitFor(() => password1.stringValue === "AXValue: \u2022\u2022\u2022\u2022\u2022"); |
| output += expect("button1.description", "'AXDescription: \u2022\u2022\u2022\u2022\u2022'"); |
| output += expect("button1.title", "'AXTitle: '"); |
| |
| output += "Update aria-labelledby to text-1 for #button-2\n"; |
| document.getElementById("button-2").setAttribute("aria-labelledby", "text-1"); |
| await waitFor(() => button2.description === "AXDescription: Before password After password"); |
| output += expect("button2.description", "'AXDescription: Before password After password'"); |
| output += expect("button2.title", "'AXTitle: '"); |
| |
| output += "Update value for #password-2\n"; |
| document.getElementById("password-2").value = "hello"; |
| await waitFor(() => password2.stringValue === "AXValue: \u2022\u2022\u2022\u2022\u2022"); |
| output += expect("button2.description", "'AXDescription: Before password \u2022\u2022\u2022\u2022\u2022 After password'"); |
| output += expect("button2.title", "'AXTitle: '"); |
| |
| debug(output); |
| finishJSTest(); |
| }, 0); |
| } |
| </script> |
| </body> |
| </html> |