Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-4 / styles-update-from-js.html
blob57d7d19d23a9926340f5cfeeb752510b9744f2af
1 <html>
2 <head>
3 <style>
4 .red div:first-child {
5 background-color: red;
8 div[foo="bar"] + div {
9 background-color: blue;
12 </style>
13 <script src="../../../http/tests/inspector/inspector-test.js"></script>
14 <script src="../../../http/tests/inspector/elements-test.js"></script>
15 <script>
16 function modifyStyleAttribute()
18 document.getElementById("container").setAttribute("style", "color: #daC0DE; border: 1px solid black;");
21 function modifyCSSText()
23 document.getElementById("container").style.cssText = "color: #C0FFEE";
26 function modifyParsedAttributes()
28 var style = document.getElementById("container").style;
29 style.border = "2px dashed green";
30 style.borderWidth = "3px";
33 function modifyContainerClass()
35 document.getElementById("container").className = "red";
38 function modifyChildAttr()
40 document.getElementById("child").setAttribute("foo", "bar");
43 function test()
45 InspectorTest.runTestSuite([
46 function testInit(next)
48 InspectorTest.selectNodeAndWaitForStyles("container", next);
51 function testSetStyleAttribute(next)
53 waitAndDumpAttributeAndStyles(next);
54 InspectorTest.evaluateInPage("modifyStyleAttribute()");
57 function testSetStyleCSSText(next)
59 waitAndDumpAttributeAndStyles(next);
60 InspectorTest.evaluateInPage("modifyCSSText()");
63 function testSetViaParsedAttributes(next)
65 waitAndDumpAttributeAndStyles(next);
66 InspectorTest.evaluateInPage("modifyParsedAttributes()");
69 function testSetViaAncestorClass(next)
71 InspectorTest.selectNodeAndWaitForStyles("child", callback);
73 function callback()
75 waitAndDumpAttributeAndStyles(next, "child");
76 InspectorTest.evaluateInPage("modifyContainerClass()");
80 function testSetViaSiblingAttr(next)
82 InspectorTest.selectNodeAndWaitForStyles("childSibling", callback);
84 function callback()
86 waitAndDumpAttributeAndStyles(next, "childSibling");
87 InspectorTest.evaluateInPage("modifyChildAttr()");
90 ]);
92 function waitAndDumpAttributeAndStyles(next, id)
94 id = id || "container";
95 function callback()
97 dumpAttributeAndStyles(id);
98 next();
100 InspectorTest.waitForStyles(id, callback);
103 function dumpAttributeAndStyles(id)
105 var treeElement = findNodeTreeElement(id);
106 if (!treeElement) {
107 InspectorTest.addResult("'" + id + "' tree element not found");
108 return;
110 InspectorTest.addResult(treeElement.listItemElement.textContent.replace(/\u200b/g, ""));
111 InspectorTest.dumpSelectedElementStyles(true);
114 function findNodeTreeElement(id)
116 InspectorTest.firstElementsTreeOutline().runPendingUpdates();
117 var expandedNode = InspectorTest.expandedNodeWithId(id);
118 if (!expandedNode) {
119 InspectorTest.addResult("'" + id + "' node not found");
120 InspectorTest.completeTest();
122 return InspectorTest.firstElementsTreeOutline().findTreeElement(expandedNode);
125 </script>
126 </head>
128 <body onload="runTest()">
130 Tests that changes to an inline style and ancestor/sibling className from JavaScript are reflected in the Styles pane and Elements tree.
131 </p>
133 <div id="container" style="font-weight:bold"><div id="child"></div><div id="childSibling"></div></div>
135 </body>
136 </html>