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

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: Added tests 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
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..c5951ef07dfc27dfa49a7d6742ec753fadc7fda4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/sources/color-swatch-position.html
@@ -0,0 +1,70 @@
+<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:");
+ addSwatchPositions();
+
+ 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)
+ addSwatchPositions();
+ next();
+ },
+
+ function testAddLine(next)
+ {
+ var start = WebInspector.TextRange.createFromLocation(0, 0);
+ sourceFrame.textEditor.editRange(start, "/* New line */\n");
+ addSwatchPositions();
+ next();
+ },
+
+ function testDeleteLine(next)
+ {
+ var bodyLine = new WebInspector.TextRange(2, 0, 3, 0);
+ sourceFrame.textEditor.editRange(bodyLine, "");
+ addSwatchPositions();
+ next();
+ }
lushnikov 2016/07/25 23:15:36 lets add a few more tests here that test some corn
flandy 2016/07/26 01:16:46 I've added two more cases. Do you have any ideas f
+ ]);
+
+ function addSwatchPositions()
lushnikov 2016/07/25 23:15:36 dumpSwatchPositions
flandy 2016/07/26 01:16:46 Done.
+ {
+ var markers = sourceFrame.textEditor.bookmarks(range);
+ for (var i = 0; i < markers.length; i++) {
+ var marker = markers[i];
+ if (marker.type === "bookmark") {
+ var color = marker.widgetNode.firstChild.color();
+ var position = marker.find();
+ 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>

Powered by Google App Engine
This is Rietveld 408576698