| <!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> | |
| <textarea id="textarea">Foo</textarea> | |
| <script> | |
| window.jsTestIsAsync = true; | |
| var output = "This test ensures accessibility properly responds to dynamic changes in a textarea element's value.\n\n"; | |
| // There are a few layouts that happen when the page loads — run the test in window.onload to wait them out before changing | |
| // the textarea value. If we change the textarea value before these layouts occur, we pass the test no matter | |
| // what (even if our implementation is wrong). This is because a top-level children changed notification causes | |
| // the textarea to be re-built with the correct value, making us pass the test on accident. | |
| window.onload = () => { | |
| if (!window.accessibilityController) | |
| return; | |
| var textarea = accessibilityController.accessibleElementById("textarea"); | |
| output += `#textarea ${textarea.stringValue}\n`; | |
| setTimeout(async function() { | |
| output += "\nUpdating #textarea value to 'Bar'.\n"; | |
| document.getElementById("textarea").value = "Bar"; | |
| await waitFor(() => textarea.stringValue.includes("Bar")); | |
| output += `#textarea ${textarea.stringValue}\n`; | |
| debug(output); | |
| finishJSTest(); | |
| }, 0); | |
| }; | |
| </script> | |
| </body> | |
| </html> | |