Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-3 / styles-add-new-rule-to-stylesheet.html
blobc49917def62ae0eadd57472f0ba1ec1365c9a719
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 src="../styles/styles-test.js"></script>
6 <link rel="stylesheet" href="../styles/resources/different-rule-types.css">
7 <script>
9 function test()
11 InspectorTest.selectNodeAndWaitForStyles("inspect", fetchStyleSheet);
13 function fetchStyleSheet()
15 var styleSheets = InspectorTest.cssModel.allStyleSheets();
16 for (var i = 0; i < styleSheets.length; ++i) {
17 var styleSheetHeader = styleSheets[i];
18 if (styleSheetHeader.sourceURL.indexOf("different-rule-types.css") === -1)
19 continue;
20 InspectorTest.addNewRuleInStyleSheet(styleSheetHeader, "#other, div", onRuleAdded);
21 return;
25 function onRuleAdded()
27 InspectorTest.selectNodeAndWaitForStyles("other", onNodeSelected);
30 function onNodeSelected()
32 InspectorTest.dumpSelectedElementStyles(true, false, true);
33 InspectorTest.completeTest();
37 </script>
38 </head>
40 <body onload="runTest()">
41 <p>
42 Tests that adding new rule in the stylesheet end works as expected.
43 </p>
45 <div class="inspected">Styled element</div>
46 <div id="inspect"></div>
47 <div id="other"></div>
49 </body>
50 </html>