Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / styles / commit-selector.html
1 <html>
2 <head>
3 <style>
4 #inspected {
5   color: green;
6 }
7 </style>
8 <script src="../../http/tests/inspector/inspector-test.js"></script>
9 <script src="../../http/tests/inspector/elements-test.js"></script>
10 <script>
11
12 function test()
13 {
14     WebInspector.showPanel("elements");
15     InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
16
17     function step1()
18     {
19         InspectorTest.addResult("=== Before selector modification ===");
20         InspectorTest.dumpSelectedElementStyles(true);
21         var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
22         section.startEditingSelector();
23         section._selectorElement.textContent = "hr, #inspected ";
24         section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
25         InspectorTest.runAfterPendingDispatches(step2);
26     }
27
28     function step2()
29     {
30         InspectorTest.addResult("=== After non-affecting selector modification ===");
31         InspectorTest.dumpSelectedElementStyles(true);
32         var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
33         section.startEditingSelector();
34         section._selectorElement.textContent = "#inspectedChanged";
35         section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
36         InspectorTest.runAfterPendingDispatches(step3);
37     }
38
39     function step3()
40     {
41         InspectorTest.addResult("=== After affecting selector modification ===");
42         InspectorTest.dumpSelectedElementStyles(true);
43         InspectorTest.completeTest();
44     }
45 }
46
47 </script>
48 </head>
49
50 <body onload="runTest()">
51 <p>
52 Tests that renaming a selector updates element styles. <a href="https://bugs.webkit.org/show_bug.cgi?id=70018">Bug 70018</a>.
53 </p>
54
55 <div id="inspected" style="color: red">Text</div>
56 <div id="other"></div>
57
58 </body>
59 </html>