Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / css / css-set-effective-property-value.html
blob1473050e799ab83d4cc1cc15ac666c2ff2540c4e
1 <html>
2 <head>
3 <link rel="stylesheet" href="resources/set-active-property-value.css"/>
4 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
5 <script type="text/javascript" src="../../http/tests/inspector-protocol/css-protocol-test.js"></script>
6 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-protocol-test.js"></script>
7 <script type="text/javascript">
9 function test()
11 InspectorTest.sendCommandOrDie("DOM.enable", {});
12 InspectorTest.sendCommandOrDie("CSS.enable", {}, onCSSEnabled);
14 var documentNodeId;
16 function onCSSEnabled()
18 InspectorTest.requestDocumentNodeId(onDocumentNodeId);
21 function onDocumentNodeId(nodeId)
23 documentNodeId = nodeId;
24 InspectorTest.requestNodeId(documentNodeId, "#inspected", onInspectedNodeId);
27 var updateProperty;
29 function onInspectedNodeId(nodeId)
31 updateProperty = updateActiveProperty.bind(null, nodeId);
32 InspectorTest.loadAndDumpInlineAndMatchingRules(documentNodeId, "#inspected", InspectorTest.runTestSuite.bind(InspectorTest, testSuite));
35 function updateActiveProperty(nodeId, property, value, onSuccess)
37 InspectorTest.sendCommandOrDie("CSS.setEffectivePropertyValueForNode", {"nodeId" : nodeId, "propertyName" : property, "value" : value}, onSuccess);
40 function dumpUndoAndNext(next, id)
42 return InspectorTest.loadAndDumpInlineAndMatchingRules.bind(InspectorTest, documentNodeId, id || "#inspected", InspectorTest.undoAndNext(next));
45 var testSuite = [
46 function testBasicPropertyChange(next)
48 updateProperty("padding-left", "101px", dumpUndoAndNext(next));
51 function testChangePropertyInShortHand(next)
53 updateProperty("padding-bottom", "101px", dumpUndoAndNext(next));
56 function testChangeImportantProperty(next)
58 updateProperty("margin-left", "101px", dumpUndoAndNext(next));
61 function testChangeInlineProperty(next)
63 updateProperty("padding-top", "101px", dumpUndoAndNext(next));
66 function testChangeInlineImportantProperty(next)
68 updateProperty("margin-top", "101px", dumpUndoAndNext(next));
71 function testChangeMissingProperty(next)
73 updateProperty("margin-bottom", "101px", dumpUndoAndNext(next));
76 function testAppendWithSeparator(next)
79 InspectorTest.loadAndDumpInlineAndMatchingRules(documentNodeId, "#append-test", InspectorTest.requestNodeId.bind(null, documentNodeId, "#append-test", modify));
81 function modify(nodeId)
83 InspectorTest.log("Resulting styles");
84 InspectorTest.sendCommandOrDie("CSS.setEffectivePropertyValueForNode", {"nodeId" : nodeId, "propertyName" : "padding-right", "value" : "101px"}, dumpUndoAndNext(next, "#append-test"));
90 </script>
91 </head>
92 <body onload="runTest();">
93 <p>The test verifies functionality of protocol method CSS.setStyleText.</p>
94 <div id="inspected" style="padding-top: 55px; margin-top: 33px !important;"></div>
95 <div id="append-test" style="padding-left: 10px"/>
96 </body>
97 </html>