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

Unified Diff: third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html

Issue 2856933006: DevTools: fix text offset when selection ends on expand triangle (Closed)
Patch Set: Created 3 years, 8 months 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: third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
diff --git a/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html b/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
index 6cd952915862ac061ae2c0ee964995b3c587da23..55f0fe6d02e7eb294c2fa1515d107b1b3cc4ca05 100644
--- a/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
+++ b/third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html
@@ -12,6 +12,7 @@ function test()
var shortUrlWithHashes = "www." + "0123456789".repeat(2) + "zfoobarz" + "0123456789".repeat(2);
var urlWithHashes = "www." + "0123456789".repeat(2) + "z".repeat(150) + "0123456789".repeat(2);
var highlightedUrl = "www." + "z".repeat(200) + ".com";
+ var longUrlInMessageWithNonTextNodePrefix = "www." + "z123456789".repeat(15) + ".com";
var prepareCode = `
// Keep this as the first url logged to record the max truncated length.
console.log("${longUrl}");
@@ -22,9 +23,10 @@ function test()
console.log("${shortUrlWithHashes}");
console.log("${urlWithHashes}");
console.log("${highlightedUrl}");
+ console.log("${longUrlInMessageWithNonTextNodePrefix}");
`;
- var expectedMessageCount = 8;
+ var expectedMessageCount = 9;
var consoleView = Console.ConsoleView.instance();
var viewport = Console.ConsoleView.instance()._viewport;
var maxLength;
@@ -120,6 +122,25 @@ function test()
function testSelectWithinHighlightedUrlEnd(next) {
testHighlightedUrlWithSearchQuery(".com", next);
+ },
+
+ function testSelectionStartingInNonTextNode(next) {
+ var messageElement = consoleView.itemElement(8).element();
+
+ // Artificially insert an empty non-text node element in the beginning.
+ var artificialEmptyPrefixElement = createElementWithClass('div', 'artificialEmptyPrefixElement');
+ messageElement.insertBefore(artificialEmptyPrefixElement, messageElement.firstChild);
+
+ // Use .childNodes to ensure we get all nodes.
+ InspectorTest.addResult("\nMaking selection from empty prefix to end");
+ window.getSelection().setBaseAndExtent(artificialEmptyPrefixElement, 0, messageElement.lastChild, messageElement.childNodes.length - 1);
+
+ var selectedText = viewport._selectedText();
+ if (selectedText)
+ InspectorTest.addResult("Selection length: " + selectedText.length + ", " + "text: " + selectedText.replace(/\bVM:\d+/g, "VM"));
+ else
+ InspectorTest.addResult("No selection");
+ next();
}
];

Powered by Google App Engine
This is Rietveld 408576698