Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/text-prompt-hint.html

Issue 2439223002: DevTools: Use grey hint text for applied suggestion in TextPrompt (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 { 48 {
49 completionsDone(); 49 completionsDone();
50 dumpTextPrompt(); 50 dumpTextPrompt();
51 typeCharacter(null); 51 typeCharacter(null);
52 waitForAutocomplete(step5); 52 waitForAutocomplete(step5);
53 } 53 }
54 function step5() 54 function step5()
55 { 55 {
56 completionsDone(); 56 completionsDone();
57 dumpTextPrompt(); 57 dumpTextPrompt();
58 prompt.setText("something_before test");
59 prompt.complete();
60 completionsDone();
61 dumpTextPrompt();
58 UnitTest.completeTest(); 62 UnitTest.completeTest();
59 } 63 }
60 64
61 function completions(element, range, force, callback) 65 function completions(element, range, force, callback)
62 { 66 {
63 UnitTest.addResult("Requesting completions"); 67 UnitTest.addResult("Requesting completions");
64 completionsDone = () => callback(suggestions.filter(s => s.startsWith(ra nge.toString()))); 68 completionsDone = () => callback(suggestions.filter(s => s.startsWith(ra nge.toString())));
65 var temp = waitingForAutocomplete; 69 var temp = waitingForAutocomplete;
66 waitingForAutocomplete = null; 70 waitingForAutocomplete = null;
67 if (temp) 71 if (temp)
(...skipping 15 matching lines...) Expand all
83 function typeCharacter(character) 87 function typeCharacter(character)
84 { 88 {
85 var keyboardEvent = new KeyboardEvent("keydown", { 89 var keyboardEvent = new KeyboardEvent("keydown", {
86 key: character || "Backspace", 90 key: character || "Backspace",
87 charCode: character ? character.charCodeAt(0) : "" 91 charCode: character ? character.charCodeAt(0) : ""
88 }); 92 });
89 element.dispatchEvent(keyboardEvent); 93 element.dispatchEvent(keyboardEvent);
90 94
91 var selection = element.getComponentSelection(); 95 var selection = element.getComponentSelection();
92 var range = selection.getRangeAt(0); 96 var range = selection.getRangeAt(0);
93 var textNode = prompt._autocompleteElement ? prompt._autocompleteElement .previousSibling : element.childTextNodes()[element.childTextNodes().length-1]; 97 var textNode = prompt._autocompleteElement.parentNode ? prompt._autocomp leteElement.previousSibling : element.childTextNodes()[element.childTextNodes(). length-1];
94 if (!character) 98 if (!character)
95 textNode.textContent = textNode.textContent.substring(0,textNode.tex tContent.length-1); 99 textNode.textContent = textNode.textContent.substring(0,textNode.tex tContent.length-1);
96 else 100 else
97 textNode.textContent += character; 101 textNode.textContent += character;
98 range.setStart(range.startContainer, range.startContainer.textContent.le ngth); 102 range.setStart(range.startContainer, range.startContainer.textContent.le ngth);
99 selection.removeAllRanges(); 103 selection.removeAllRanges();
100 selection.addRange(range); 104 selection.addRange(range);
101 element.dispatchEvent(new Event("input", {bubbles: true, cancelable: fal se})); 105 element.dispatchEvent(new Event("input", {bubbles: true, cancelable: fal se}));
102 } 106 }
103 } 107 }
104 108
105 109
106 </script> 110 </script>
107 </head> 111 </head>
108 <body> 112 <body>
109 <p>Tests that the hint displays properly on a WebInspector.TextPrompt with autoc omplete.</p> 113 <p>Tests that the hint displays properly on a WebInspector.TextPrompt with autoc omplete.</p>
110 </body> 114 </body>
111 </html> 115 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698