Chromium Code Reviews| 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> |