Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-1 / add-new-rule-with-style-after-body.html
blob4c3300e54213d04a29b2a96743982c0bba0b557f
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 function addStyle()
8 var style = document.createElement("style");
9 document.documentElement.appendChild(style);
10 style.sheet.insertRule("foo {display: none;}", 0);
13 function test()
15 InspectorTest.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded, stylesheetAdded);
16 InspectorTest.evaluateInPage("addStyle()");
18 function stylesheetAdded()
20 InspectorTest.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAdded, stylesheetAdded);
21 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
24 var treeElement;
25 var hasResourceChanged;
27 function step1()
29 InspectorTest.addNewRule("inspected", step2);
32 function step2()
34 var section = InspectorTest.firstMatchedStyleSection();
35 var newProperty = section.addNewBlankProperty();
36 newProperty.startEditing();
37 newProperty.nameElement.textContent = "color";
38 newProperty.nameElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
39 newProperty.valueElement.textContent = "maroon";
40 newProperty.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
41 InspectorTest.waitForStyles("inspected", step3);
44 function step3()
46 InspectorTest.addResult("After adding new rule:");
47 InspectorTest.dumpSelectedElementStyles(true, false, true);
48 InspectorTest.completeTest();
52 </script>
53 </head>
55 <body onload="runTest()">
56 <p>
57 Tests that adding a new rule works when there is a STYLE element after BODY. TIMEOUT SHOULD NOT OCCUR! <a href="https://bugs.webkit.org/show_bug.cgi?id=111299">Bug 111299</a>
58 </p>
60 <div id="inspected" style="font-size: 12px">Text</div>
62 </body>
63 </html>