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

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: newline for test 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();
62 typeCharacter("T");
63 dumpTextPrompt();
58 UnitTest.completeTest(); 64 UnitTest.completeTest();
59 } 65 }
60 66
61 function completions(element, range, force, callback) 67 function completions(element, range, force, callback)
62 { 68 {
63 UnitTest.addResult("Requesting completions"); 69 UnitTest.addResult("Requesting completions");
64 completionsDone = () => callback(suggestions.filter(s => s.startsWith(ra nge.toString()))); 70 completionsDone = () => callback(suggestions.filter(s => s.startsWith(ra nge.toString())));
65 var temp = waitingForAutocomplete; 71 var temp = waitingForAutocomplete;
66 waitingForAutocomplete = null; 72 waitingForAutocomplete = null;
67 if (temp) 73 if (temp)
(...skipping 15 matching lines...) Expand all
83 function typeCharacter(character) 89 function typeCharacter(character)
84 { 90 {
85 var keyboardEvent = new KeyboardEvent("keydown", { 91 var keyboardEvent = new KeyboardEvent("keydown", {
86 key: character || "Backspace", 92 key: character || "Backspace",
87 charCode: character ? character.charCodeAt(0) : "" 93 charCode: character ? character.charCodeAt(0) : ""
88 }); 94 });
89 element.dispatchEvent(keyboardEvent); 95 element.dispatchEvent(keyboardEvent);
90 96
91 var selection = element.getComponentSelection(); 97 var selection = element.getComponentSelection();
92 var range = selection.getRangeAt(0); 98 var range = selection.getRangeAt(0);
93 var textNode = prompt._autocompleteElement ? prompt._autocompleteElement .previousSibling : element.childTextNodes()[element.childTextNodes().length-1]; 99 var textNode = prompt._autocompleteElement.parentNode ? prompt._autocomp leteElement.previousSibling : element.childTextNodes()[element.childTextNodes(). length-1];
94 if (!character) 100 if (!character)
95 textNode.textContent = textNode.textContent.substring(0,textNode.tex tContent.length-1); 101 textNode.textContent = textNode.textContent.substring(0,textNode.tex tContent.length-1);
96 else 102 else
97 textNode.textContent += character; 103 textNode.textContent += character;
98 range.setStart(range.startContainer, range.startContainer.textContent.le ngth); 104 range.setStart(range.startContainer, range.startContainer.textContent.le ngth);
99 selection.removeAllRanges(); 105 selection.removeAllRanges();
100 selection.addRange(range); 106 selection.addRange(range);
101 element.dispatchEvent(new Event("input", {bubbles: true, cancelable: fal se})); 107 element.dispatchEvent(new Event("input", {bubbles: true, cancelable: fal se}));
102 } 108 }
103 } 109 }
104 110
105 111
106 </script> 112 </script>
107 </head> 113 </head>
108 <body> 114 <body>
109 <p>Tests that the hint displays properly on a WebInspector.TextPrompt with autoc omplete.</p> 115 <p>Tests that the hint displays properly on a WebInspector.TextPrompt with autoc omplete.</p>
110 </body> 116 </body>
111 </html> 117 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698