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

Unified Diff: third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position.html

Issue 2173913002: DevTools: Optimize source color picker to analyze changed lines (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@escSpectrum
Patch Set: Address last comment Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position.html
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position.html b/third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position.html
new file mode 100644
index 0000000000000000000000000000000000000000..7ac132c5d94efee10205af851c3842175e2f1182
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position.html
@@ -0,0 +1,83 @@
+<html>
+<head>
+
+<link rel="stylesheet" href="resources/color.css">
+
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="../../http/tests/inspector/debugger-test.js"></script>
+<script>
+function test()
+{
+ Runtime.experiments.enableForTest("sourceColorPicker");
+ InspectorTest.showScriptSource("color.css", onSourceFrame);
+
+ function onSourceFrame(sourceFrame)
+ {
+ var range = new WebInspector.TextRange(0, 0, 6, 0);
+ InspectorTest.addResult("Initial swatch positions:");
+ dumpSwatchPositions();
+
+ InspectorTest.runTestSuite([
+ function testEditSpectrum(next)
+ {
+ var swatch = sourceFrame.textEditor._codeMirrorElement.querySelector("span[is=color-swatch]");
+ swatch.shadowRoot.querySelector(".color-swatch-inner").click();
+ sourceFrame._spectrum._innerSetColor(WebInspector.Color.parse("#008000").hsva(), "", WebInspector.Color.Format.HEX, WebInspector.Spectrum._ChangeSource.Other);
+ sourceFrame._swatchPopoverHelper.hide(true)
+ dumpSwatchPositions();
+ next();
+ },
+
+ function testAddLine(next)
+ {
+ var start = WebInspector.TextRange.createFromLocation(0, 0);
+ sourceFrame.textEditor.editRange(start, "/* New line */\n");
+ dumpSwatchPositions();
+ next();
+ },
+
+ function testDeleteLine(next)
+ {
+ var bodyLine = new WebInspector.TextRange(2, 0, 3, 0);
+ sourceFrame.textEditor.editRange(bodyLine, "");
+ dumpSwatchPositions();
+ next();
+ },
+
+ function testAddColor(next)
+ {
+ var emptyBodyLine = new WebInspector.TextRange(2, 0, 2, 0);
+ sourceFrame.textEditor.editRange(emptyBodyLine, "color: hsl(300, 100%, 35%);");
+ dumpSwatchPositions();
+ next();
+ },
+
+ function testInvalidateColor(next)
+ {
+ var endParenthesis = new WebInspector.TextRange(2, 25, 2, 26);
+ sourceFrame.textEditor.editRange(endParenthesis, "]");
+ dumpSwatchPositions();
+ next();
+ }
+ ]);
+
+ function dumpSwatchPositions()
+ {
+ var markers = sourceFrame.textEditor.bookmarks(range);
+ for (var i = 0; i < markers.length; i++) {
+ var position = markers[i].find();
+ var color = markers[i].widgetNode.firstChild.color();
+ InspectorTest.addResult("Line " + position.line + ", Column " + position.ch + ": " + color.asString(color.format()));
+ }
+ }
+ }
+}
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests that color swatch positions are updated properly.
+</p>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698