[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / inspector / styles / styles-add-new-rule.html
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>
6
7 function test()
8 {
9     WebInspector.showPanel("elements");
10     InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
11     InspectorTest.addSniffer(WebInspector.Resource.prototype, "addRevision", revisionAdded);
12
13     var treeElement;
14     var hasResourceChanged;
15
16     function step1()
17     {
18         // Click "Add new rule".
19         document.getElementById("add-style-button-test-id").click();
20         var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
21         section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
22         InspectorTest.runAfterPendingDispatches(step2);
23     }
24
25     function step2()
26     {
27         var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
28         var newProperty = section.addNewBlankProperty();
29         newProperty.startEditing();
30         newProperty.nameElement.textContent = "color";
31         newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
32         newProperty.valueElement.textContent = "maroon";
33         newProperty.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
34         InspectorTest.selectNodeAndWaitForStyles("other", step3);
35     }
36
37     function step3()
38     {
39         // Click "Add new rule".
40         document.getElementById("add-style-button-test-id").click();
41         InspectorTest.selectNodeAndWaitForStyles("inspected", step4);
42     }
43
44     function step4()
45     {
46         InspectorTest.addResult("After adding new rule (inspected):");
47         InspectorTest.dumpSelectedElementStyles(true, false, true);
48         InspectorTest.selectNodeAndWaitForStyles("other", step5);
49     }
50
51     function step5()
52     {
53         InspectorTest.addResult("After adding new rule (other):");
54         InspectorTest.dumpSelectedElementStyles(true, false, true);
55         InspectorTest.completeTest();
56     }
57
58     function revisionAdded(revision)
59     {
60         InspectorTest.addResult("Revision added: " + this.parsedURL.displayName);
61     }
62 }
63
64 </script>
65 </head>
66
67 <body onload="runTest()">
68 <p>
69 Tests that adding a new rule works after switching nodes.
70 </p>
71
72 <div id="inspected" style="font-size: 12px">Text</div>
73 <div id="other" style="color:red"></div>
74
75 </body>
76 </html>