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

Unified Diff: LayoutTests/inspector-protocol/css/css-edit-range-inline-attr.html

Issue 172593003: DevTools: [CSS] Add CSS.editRangeInStyleSheetText() to the protocol (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix glitch Created 6 years, 9 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: LayoutTests/inspector-protocol/css/css-edit-range-inline-attr.html
diff --git a/LayoutTests/inspector-protocol/css/css-edit-range-inline-attr.html b/LayoutTests/inspector-protocol/css/css-edit-range-inline-attr.html
new file mode 100644
index 0000000000000000000000000000000000000000..7bb5443709a24d1c34096ea46e8b8039f56f7bdd
--- /dev/null
+++ b/LayoutTests/inspector-protocol/css/css-edit-range-inline-attr.html
@@ -0,0 +1,89 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script type="text/javascript" src="css-protocol-test.js"></script>
+<script type="text/javascript" src="edit-range-utils.js"></script>
+<script type="text/javascript">
+function test()
+{
+ var editStyleSheet;
+ var checkProtocolError;
+
+ InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled);
+
+ function onCSSEnabled()
+ {
+ InspectorTest.requestNodeId("#reddiv", onNodeRecieved);
+ }
+
+ function onNodeRecieved(nodeId)
+ {
+ InspectorTest.sendCommandOrDie("CSS.getInlineStylesForNode", {
+ nodeId: nodeId,
+ }, onInlineStyleRecieved);
+ }
+
+ function onInlineStyleRecieved(result)
+ {
+ var styleSheetId = result.inlineStyle.styleId.styleSheetId;
+ editStyleSheet = InspectorTest.editStyleSheet.bind(null, styleSheetId);
+ checkProtocolError = InspectorTest.checkProtocolError.bind(null, styleSheetId);
+ InspectorTest.sendCommandOrDie("CSS.getStyleSheetText", { styleSheetId: styleSheetId }, onInitialStyleSheetText);
+ }
+
+ function onInitialStyleSheetText(result)
+ {
+ InspectorTest.log("==== Initial style sheet text ====");
+ InspectorTest.log(result.text);
+ InspectorTest.runTestSuite(testSuite);
+ }
+
+ var testSuite = [
+ function testEditProperty(next)
+ {
+ editStyleSheet({
+ range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 10 },
+ text: "content: 'EDITED PROPERTY'"
+ }, InspectorTest.undoAndNext(next));
+ },
+
+ function testBreakingCommentEditProperty(next)
+ {
+ checkProtocolError({
+ range: { startLine: 0, startColumn: 4, endLine: 0, endColumn: 10 },
+ text: "/*<--OPENED COMMENT"
+ }, next);
+ },
+
+ function testInsertFirstProperty(next)
+ {
+ editStyleSheet({
+ range: { startLine: 0, startColumn: 0, endLine: 0, endColumn: 0 },
+ text: "content: 'INSERTED PROPERTY';"
+ }, InspectorTest.undoAndNext(next));
+ },
+
+ function testInsertLastProperty(next)
+ {
+ editStyleSheet({
+ range: { startLine: 0, startColumn: 24, endLine: 0, endColumn: 24 },
+ text: "content: 'INSERTED PROPERTY';"
+ }, InspectorTest.undoAndNext(next));
+ },
+
+ function testInsertMultipleProperties(next)
+ {
+ editStyleSheet({
+ range: { startLine: 0, startColumn: 11, endLine: 0, endColumn: 11 },
+ text: "content: 'INSERTED #1';content: 'INSERTED #2';"
+ }, InspectorTest.undoAndNext(next));
+ },
+];
+}
+
+</script>
+</head>
+<body onload="runTest();">
+ <div id="reddiv" style="color: red; border: 0px;">Some red text goes here</div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698