| <!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="test-content" contenteditable="true"> |
| <p>The quick <em>brown</em><span id="target1"></span> fox jumps over <span id="target2"></span><b>the</b> lazy dog.</p> |
| </div> |
| |
| <script> |
| var output = "Tests that text operations are performed as expected at node boundaries.\n\n"; |
| |
| if (window.accessibilityController) { |
| window.jsTestIsAsync = true; |
| |
| var testContent = accessibilityController.accessibleElementById("test-content"); |
| var operationResult; |
| setTimeout(async function() { |
| var markers = [ |
| await selectElementTextById("target2"), |
| await selectElementTextById("target1"), |
| ]; |
| |
| await waitForNotification(testContent, "AXValueChanged", () => { |
| operationResult = testContent.performTextOperation("TextOperationReplacePreserveCase", markers, " foo ", /* smart replace */ false); |
| }); |
| |
| output += expect("operationResult.length", "2"); |
| output += expect("operationResult[0]", "' foo '"); |
| output += expect("operationResult[1]", "' foo '"); |
| output += expect("testContent.stringValue.replace(/\\s/g, ' ')", "'AXValue: The quick brown foo fox jumps over foo the lazy dog.'"); |
| |
| document.getElementById("test-content").remove(); |
| debug(output); |
| finishJSTest(); |
| }, 0); |
| } |
| </script> |
| </body> |
| </html> |