| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <base href="/inspector-debug/"></base> | 3 <base href="/inspector-debug/"></base> |
| 4 <script src="/inspector-debug/Runtime.js"></script> | 4 <script src="/inspector-debug/Runtime.js"></script> |
| 5 <script src="/inspector-unit/inspector-unit-test.js"></script> | 5 <script src="/inspector-unit/inspector-unit-test.js"></script> |
| 6 <script type="text/javascript"> | 6 <script type="text/javascript"> |
| 7 | 7 |
| 8 function test() | 8 function test() |
| 9 { | 9 { |
| 10 var suggestions = ["testTextPrompt"]; | 10 var suggestions = ["testTextPrompt"]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 { | 49 { |
| 50 completionsDone(); | 50 completionsDone(); |
| 51 dumpTextPrompt(); | 51 dumpTextPrompt(); |
| 52 typeCharacter(null); | 52 typeCharacter(null); |
| 53 waitForAutocomplete(step5); | 53 waitForAutocomplete(step5); |
| 54 } | 54 } |
| 55 function step5() | 55 function step5() |
| 56 { | 56 { |
| 57 completionsDone(); | 57 completionsDone(); |
| 58 dumpTextPrompt(); | 58 dumpTextPrompt(); |
| 59 prompt.setText("something_before test"); |
| 60 prompt.complete(); |
| 61 completionsDone(); |
| 62 dumpTextPrompt(); |
| 63 typeCharacter("T"); |
| 64 dumpTextPrompt(); |
| 59 UnitTest.completeTest(); | 65 UnitTest.completeTest(); |
| 60 } | 66 } |
| 61 | 67 |
| 62 function completions(element, range, force, callback) | 68 function completions(element, range, force, callback) |
| 63 { | 69 { |
| 64 UnitTest.addResult("Requesting completions"); | 70 UnitTest.addResult("Requesting completions"); |
| 65 completionsDone = () => callback(suggestions.filter(s => s.startsWith(ra
nge.toString()))); | 71 completionsDone = () => callback(suggestions.filter(s => s.startsWith(ra
nge.toString()))); |
| 66 var temp = waitingForAutocomplete; | 72 var temp = waitingForAutocomplete; |
| 67 waitingForAutocomplete = null; | 73 waitingForAutocomplete = null; |
| 68 if (temp) | 74 if (temp) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 84 function typeCharacter(character) | 90 function typeCharacter(character) |
| 85 { | 91 { |
| 86 var keyboardEvent = new KeyboardEvent("keydown", { | 92 var keyboardEvent = new KeyboardEvent("keydown", { |
| 87 key: character || "Backspace", | 93 key: character || "Backspace", |
| 88 charCode: character ? character.charCodeAt(0) : "" | 94 charCode: character ? character.charCodeAt(0) : "" |
| 89 }); | 95 }); |
| 90 element.dispatchEvent(keyboardEvent); | 96 element.dispatchEvent(keyboardEvent); |
| 91 | 97 |
| 92 var selection = element.getComponentSelection(); | 98 var selection = element.getComponentSelection(); |
| 93 var range = selection.getRangeAt(0); | 99 var range = selection.getRangeAt(0); |
| 94 var textNode = prompt._ghostTextElement ? prompt._ghostTextElement.previ
ousSibling : element.childTextNodes()[element.childTextNodes().length - 1]; | 100 var textNode = prompt._ghostTextElement.parentNode ? prompt._ghostTextEl
ement.previousSibling : element.childTextNodes()[element.childTextNodes().length
- 1]; |
| 95 if (!character) | 101 if (!character) |
| 96 textNode.textContent = textNode.textContent.substring(0,textNode.tex
tContent.length-1); | 102 textNode.textContent = textNode.textContent.substring(0,textNode.tex
tContent.length-1); |
| 97 else | 103 else |
| 98 textNode.textContent += character; | 104 textNode.textContent += character; |
| 99 range.setStart(range.startContainer, range.startContainer.textContent.le
ngth); | 105 range.setStart(range.startContainer, range.startContainer.textContent.le
ngth); |
| 100 selection.removeAllRanges(); | 106 selection.removeAllRanges(); |
| 101 selection.addRange(range); | 107 selection.addRange(range); |
| 102 element.dispatchEvent(new Event("input", {bubbles: true, cancelable: fal
se})); | 108 element.dispatchEvent(new Event("input", {bubbles: true, cancelable: fal
se})); |
| 103 } | 109 } |
| 104 } | 110 } |
| 105 | 111 |
| 106 | 112 |
| 107 </script> | 113 </script> |
| 108 </head> | 114 </head> |
| 109 <body> | 115 <body> |
| 110 <p>Tests that the hint displays properly on a WebInspector.TextPrompt with autoc
omplete.</p> | 116 <p>Tests that the hint displays properly on a WebInspector.TextPrompt with autoc
omplete.</p> |
| 111 </body> | 117 </body> |
| 112 </html> | 118 </html> |
| OLD | NEW |