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

Unified Diff: LayoutTests/inspector/console/console-search-can-jump-forward-between-tree-element-matches.html

Issue 676193002: Navigate between individual search matches in DevTools console (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Add tests Created 6 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/console/console-search-can-jump-forward-between-tree-element-matches.html
diff --git a/LayoutTests/inspector/console/console-search-can-jump-forward-between-tree-element-matches.html b/LayoutTests/inspector/console/console-search-can-jump-forward-between-tree-element-matches.html
new file mode 100644
index 0000000000000000000000000000000000000000..4eb62d3db065419899fa609702bd380e9941c414
--- /dev/null
+++ b/LayoutTests/inspector/console/console-search-can-jump-forward-between-tree-element-matches.html
@@ -0,0 +1,75 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/console-test.js"></script>
+<script>
+function populateConsoleWithMessages()
+{
+ console.dir(window);
+ runTest();
+}
+
+function test()
+{
+ function addResult(result)
+ {
+ viewport.refresh();
+ InspectorTest.addResult(result);
+ }
+
+ // Make sure to produce test output in case test times out
+ setTimeout(InspectorTest.completeTest.bind(InspectorTest), 2000);
+
+ var consoleView = WebInspector.ConsolePanel._view();
+ var viewport = consoleView._viewport;
+ const maximumViewportMessagesCount = 150;
+ InspectorTest.runTestSuite([
+ function assertViewportHeight(next)
+ {
+ viewport.invalidate();
+ var viewportMessagesCount = viewport._lastVisibleIndex - viewport._firstVisibleIndex;
+ if (viewportMessagesCount > maximumViewportMessagesCount) {
+ InspectorTest.addResult(String.sprintf(
+ "Test cannot be run because viewport can fit %d messages, while %d is the test's maximum.",
+ viewportMessagesCount, maximumViewportMessagesCount));
+ InspectorTest.completeTest();
+ return;
+ }
+ next();
+ },
+
+ function scrollConsoleToTop(next)
+ {
+ viewport.forceScrollItemToBeFirst(0);
+ addResult("first visible message index: " + viewport.firstVisibleIndex());
+ next();
+ },
+
+ function testFindMatches(next)
+ {
+ InspectorTest.expandConsoleMessages(function()
+ {
+ consoleView._searchableView._searchInputElement.value = "HTML";
+ consoleView._searchableView.showSearchField();
+
+ // Find first match
+ consoleView._searchableView.handleFindNextShortcut();
+ // XXX: How to output currently matched tree element?
+
+ // Find second match
+ consoleView._searchableView.handleFindNextShortcut();
+ // XXX: How to output currently matched tree element?
+
+ next();
+ });
+ }
+ ]);
+}
+</script>
+</head>
+<body onload="populateConsoleWithMessages()">
+<p>
+ Tests that console can jump forward between search matches in tree elements.
+</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698