 Chromium Code Reviews
 Chromium Code Reviews Issue 676193002:
  Navigate between individual search matches in DevTools console  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink@master
    
  
    Issue 676193002:
  Navigate between individual search matches in DevTools console  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink@master| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../http/tests/inspector/console-test.js"></script> | |
| 5 <script> | |
| 6 function populateConsoleWithMessages() | |
| 7 { | |
| 8 console.log("FIRST MATCH, SECOND MATCH"); | |
| 9 for (var i = 0; i < 200; ++i) | |
| 10 console.log("Message #" + i); | |
| 11 var a = {}; | |
| 12 for (var i = 0; i < 200; ++i) | |
| 13 a["field_" + i] = "value #" + i; | |
| 14 console.dir(a); | |
| 15 console.log("LAST MATCH"); | |
| 16 runTest(); | |
| 17 } | |
| 18 | |
| 19 function test() | |
| 20 { | |
| 21 function addResult(result) | |
| 22 { | |
| 23 viewport.refresh(); | |
| 24 InspectorTest.addResult(result); | |
| 25 } | |
| 26 | |
| 27 function setQuery(text) | |
| 28 { | |
| 29 consoleView._searchableView._searchInputElement.value = text; | |
| 30 consoleView._searchableView.showSearchField(); | |
| 31 } | |
| 32 | |
| 33 var consoleView = WebInspector.ConsolePanel._view(); | |
| 34 var viewport = consoleView._viewport; | |
| 35 const maximumViewportMessagesCount = 150; | |
| 36 InspectorTest.runTestSuite([ | |
| 37 function assertViewportHeight(next) | |
| 38 { | |
| 39 viewport.invalidate(); | |
| 40 var viewportMessagesCount = viewport._lastVisibleIndex - viewport._f irstVisibleIndex; | |
| 41 if (viewportMessagesCount > maximumViewportMessagesCount) { | |
| 42 InspectorTest.addResult(String.sprintf( | |
| 43 "Test cannot be run because viewport can fit %d messages, whil e %d is the test's maximum.", | |
| 44 viewportMessagesCount, maximumViewportMessagesCount)); | |
| 45 InspectorTest.completeTest(); | |
| 46 return; | |
| 47 } | |
| 48 next(); | |
| 49 }, | |
| 50 | |
| 51 function scrollConsoleToTop(next) | |
| 52 { | |
| 53 viewport.forceScrollItemToBeFirst(0); | |
| 54 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
| 55 next(); | |
| 56 }, | |
| 57 | |
| 58 function testCanJumpForward(next) | |
| 59 { | |
| 60 setQuery("MATCH"); | |
| 61 | |
| 62 // Find first match | |
| 
lushnikov
2014/12/04 16:07:34
Please terminate all the comments here with period
 
aknudsen
2014/12/05 22:30:02
Done.
 | |
| 63 consoleView._searchableView.handleFindNextShortcut(); | |
| 64 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
| 65 | |
| 66 // Find second match | |
| 67 consoleView._searchableView.handleFindNextShortcut(); | |
| 68 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
| 69 | |
| 70 // Find last match | |
| 71 consoleView._searchableView.handleFindNextShortcut(); | |
| 72 addResult("last visible message index: " + viewport.lastVisibleIndex ()); | |
| 73 next(); | |
| 74 }, | |
| 75 | |
| 76 function testCanJumpBackward(next) | |
| 77 { | |
| 78 setQuery("MATCH"); | |
| 79 | |
| 80 // Start out at the first match | |
| 81 consoleView._searchableView.handleFindNextShortcut(); | |
| 82 | |
| 83 // Find last match | |
| 84 consoleView._searchableView.handleFindPreviousShortcut(); | |
| 85 addResult("last visible message index: " + viewport.lastVisibleIndex ()); | |
| 86 | |
| 87 // Find second match | |
| 88 consoleView._searchableView.handleFindPreviousShortcut(); | |
| 89 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
| 90 | |
| 91 // Find first match | |
| 92 consoleView._searchableView.handleFindPreviousShortcut(); | |
| 93 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
| 94 next(); | |
| 95 }, | |
| 96 | |
| 97 function scrollConsoleToTop(next) | |
| 98 { | |
| 99 viewport.forceScrollItemToBeFirst(0); | |
| 100 addResult("first visible message index: " + viewport.firstVisibleInd ex()); | |
| 101 next(); | |
| 102 }, | |
| 103 | |
| 104 function testCanMarkCurrentMatch(next) | |
| 105 { | |
| 106 setQuery("MATCH"); | |
| 107 | |
| 108 // Find first match | |
| 109 consoleView._searchableView.handleFindNextShortcut(); | |
| 110 addResult(InspectorTest.dumpConsoleMessagesIntoArray(false, true)); | |
| 
lushnikov
2014/12/04 16:07:34
This adds a lot of output which is impossible to r
 
aknudsen
2014/12/05 22:30:02
Done.
 | |
| 111 | |
| 112 // Find second match | |
| 113 consoleView._searchableView.handleFindNextShortcut(); | |
| 114 addResult(InspectorTest.dumpConsoleMessagesIntoArray(false, true)); | |
| 115 | |
| 116 next(); | |
| 117 }, | |
| 118 | |
| 119 function testCanJumpForwardBetweenTreeElementMatches(next) | |
| 120 { | |
| 121 InspectorTest.expandConsoleMessages(function() | |
| 122 { | |
| 123 // Find first match | |
| 124 setQuery("field_1"); | |
| 125 consoleView._searchableView.handleFindNextShortcut(); | |
| 126 var currentResultElem = document.querySelector(".current-search- result"); | |
| 127 addResult("matched tree element: " + currentResultElem.innerHTML ); | |
| 128 | |
| 129 // Find last match | |
| 130 setQuery("field_199"); | |
| 131 consoleView._searchableView.handleFindNextShortcut(); | |
| 132 currentResultElem = document.querySelector(".current-search-resu lt"); | |
| 133 addResult("matched tree element: " + currentResultElem.innerHTML ); | |
| 134 | |
| 135 next(); | |
| 136 }); | |
| 137 } | |
| 138 ]); | |
| 139 } | |
| 140 </script> | |
| 141 </head> | |
| 142 <body onload="populateConsoleWithMessages()"> | |
| 143 <p> | |
| 144 Tests console search. | |
| 145 </p> | |
| 146 </body> | |
| 147 </html> | |
| OLD | NEW |