Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-3 / styles-add-new-rule.html
blob56bf8a3a62e78e8e1b569d820fa618c8a5164980
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
5 <script>
7 var initialize_AdditionalPreload = function() {
8 InspectorTest.preloadModule("source_frame");
11 function test()
13 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
15 var treeElement;
16 var hasResourceChanged;
18 var revisionAdded = false;
19 var testFinished = false;
20 var displayName = null;
22 InspectorTest.addSniffer(WebInspector.UISourceCode.prototype, "addRevision", onRevisionAdded);
24 function step1()
26 // Click "Add new rule".
27 InspectorTest.addNewRule("foo, div#inspected, bar", step2);
30 function step2()
32 var section = InspectorTest.firstMatchedStyleSection();
33 var newProperty = section.addNewBlankProperty();
34 newProperty.startEditing();
35 textInputController.insertText("color");
36 newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
37 textInputController.insertText("maroon");
38 newProperty.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
39 InspectorTest.selectNodeAndWaitForStyles("other", step3);
42 function step3()
44 // Click "Add new rule".
45 InspectorTest.addNewRule(null, onRuleAdded);
47 function onRuleAdded()
49 InspectorTest.selectNodeAndWaitForStyles("inspected", step4);
53 function step4()
55 InspectorTest.addResult("After adding new rule (inspected):");
56 InspectorTest.dumpSelectedElementStyles(true, false, true, true);
57 InspectorTest.selectNodeAndWaitForStyles("other", step5);
60 function step5()
62 InspectorTest.addResult("After adding new rule (other):");
63 InspectorTest.dumpSelectedElementStyles(true, false, true);
65 InspectorTest.waitForStylesForClass("my-class", onStylesReceived);
66 InspectorTest.nodeWithClass("my-class", onNodeFound);
67 function onNodeFound(node)
69 WebInspector.Revealer.reveal(node);
72 function onStylesReceived()
74 InspectorTest.addNewRule(null, step6);
78 function step6()
80 InspectorTest.dumpSelectedElementStyles(true, false, true);
82 InspectorTest.waitForStylesForClass("class-1", onStylesReceived);
83 InspectorTest.nodeWithClass("class-1", onNodeFound);
84 function onNodeFound(node)
86 WebInspector.Revealer.reveal(node);
89 function onStylesReceived()
91 InspectorTest.addNewRule(null, function() {
92 InspectorTest.dumpSelectedElementStyles(true, false, true);
93 testFinished = true;
94 maybeCompleteTest();
95 });
99 function maybeCompleteTest()
101 if (!revisionAdded || !testFinished)
102 return;
103 InspectorTest.addResult("Revision added: " + displayName);
104 InspectorTest.completeTest();
107 function onRevisionAdded(revision)
109 revisionAdded = true;
110 displayName = this.displayName();
111 maybeCompleteTest();
115 </script>
116 </head>
118 <body onload="runTest()">
120 Tests that adding a new rule works after switching nodes.
121 </p>
123 <div id="inspected" style="font-size: 12px">Text</div>
124 <div id="other" style="color:red"></div>
125 <div>
126 <div class="my-class"></div>
127 <div class="my-class"></div>
128 <div class="my-class"></div>
129 </div>
131 <div class=" class-1 class-2 class-3 "></div>
133 </body>
134 </html>