OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <style> | 3 <style> |
4 div:hover, a:hover { | 4 div:hover, a:hover { |
5 color: red; | 5 color: red; |
6 } | 6 } |
7 | 7 |
8 div:focus, a:focus { | 8 div:focus, a:focus { |
9 border: 1px solid green; | 9 border: 1px solid green; |
10 } | 10 } |
11 | 11 |
12 div:active, a:active { | 12 div:active, a:active { |
13 font-weight: bold; | 13 font-weight: bold; |
14 } | 14 } |
15 | 15 |
16 </style> | 16 </style> |
17 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 17 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
18 <script src="../../../http/tests/inspector/elements-test.js"></script> | 18 <script src="../../../http/tests/inspector/elements-test.js"></script> |
19 <script> | 19 <script> |
20 | 20 |
21 function test() | 21 function test() |
22 { | 22 { |
23 WebInspector.inspectorView.showPanel("elements"); | 23 WebInspector.inspectorView.showPanel("elements"); |
24 | 24 |
25 InspectorTest.nodeWithId("div", foundDiv); | 25 InspectorTest.nodeWithId("div", foundDiv); |
26 | 26 |
27 var divNodeId; | 27 var divNode; |
28 | 28 |
29 function dumpData() | 29 function dumpData() |
30 { | 30 { |
31 InspectorTest.dumpSelectedElementStyles(true); | 31 InspectorTest.dumpSelectedElementStyles(true); |
32 InspectorTest.dumpElementsTree(); | 32 InspectorTest.dumpElementsTree(); |
33 } | 33 } |
34 | 34 |
35 function foundDiv(divNode) | 35 function foundDiv(node) |
36 { | 36 { |
37 divNodeId = divNode.id; | 37 divNode = node; |
38 WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "hover"
, true); | 38 WebInspector.panels.elements._setPseudoClassForNode(divNode, "hover", tr
ue); |
39 WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "active
", true); | 39 WebInspector.cssModel.forcePseudoState(divNode, "active", true); |
40 InspectorTest.selectNodeAndWaitForStyles("div", divSelected1); | 40 InspectorTest.selectNodeAndWaitForStyles("div", divSelected1); |
41 } | 41 } |
42 | 42 |
43 function divSelected1() | 43 function divSelected1() |
44 { | 44 { |
45 InspectorTest.addResult(""); | 45 InspectorTest.addResult(""); |
46 InspectorTest.addResult("DIV with :hover and :active"); | 46 InspectorTest.addResult("DIV with :hover and :active"); |
47 dumpData(); | 47 dumpData(); |
48 InspectorTest.waitForStyles("div", hoverCallback, true); | 48 InspectorTest.waitForStyles("div", hoverCallback, true); |
49 WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "hover"
, false); | 49 WebInspector.panels.elements._setPseudoClassForNode(divNode, "hover", fa
lse); |
50 | 50 |
51 function hoverCallback() | 51 function hoverCallback() |
52 { | 52 { |
53 InspectorTest.waitForStyles("div", divSelected2, true); | 53 InspectorTest.waitForStyles("div", divSelected2, true); |
54 WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "fo
cus", true); | 54 WebInspector.panels.elements._setPseudoClassForNode(divNode, "focus"
, true); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 function divSelected2() | 58 function divSelected2() |
59 { | 59 { |
60 InspectorTest.addResult(""); | 60 InspectorTest.addResult(""); |
61 InspectorTest.addResult("DIV with :active and :focus"); | 61 InspectorTest.addResult("DIV with :active and :focus"); |
62 dumpData(); | 62 dumpData(); |
63 InspectorTest.waitForStyles("div", focusCallback, true); | 63 InspectorTest.waitForStyles("div", focusCallback, true); |
64 WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "focus"
, false); | 64 WebInspector.panels.elements._setPseudoClassForNode(divNode, "focus", fa
lse); |
65 | 65 |
66 function focusCallback() | 66 function focusCallback() |
67 { | 67 { |
68 InspectorTest.waitForStyles("div", divSelected3, true); | 68 InspectorTest.waitForStyles("div", divSelected3, true); |
69 WebInspector.panels.elements._setPseudoClassForNodeId(divNodeId, "ac
tive", false); | 69 WebInspector.panels.elements._setPseudoClassForNode(divNode, "active
", false); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 function divSelected3(node) | 73 function divSelected3(node) |
74 { | 74 { |
75 InspectorTest.addResult(""); | 75 InspectorTest.addResult(""); |
76 InspectorTest.addResult("DIV with no forced state"); | 76 InspectorTest.addResult("DIV with no forced state"); |
77 dumpData(); | 77 dumpData(); |
78 InspectorTest.completeTest(); | 78 InspectorTest.completeTest(); |
79 } | 79 } |
80 } | 80 } |
81 </script> | 81 </script> |
82 </head> | 82 </head> |
83 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-
weight: normal; width: 85%; background-image: url(bar.png)"> | 83 <body id="mainBody" class="main1 main2 mainpage" onload="runTest()" style="font-
weight: normal; width: 85%; background-image: url(bar.png)"> |
84 <p> | 84 <p> |
85 Tests that forced element state is reflected in the DOM tree and Styles pane. | 85 Tests that forced element state is reflected in the DOM tree and Styles pane. |
86 </p> | 86 </p> |
87 <div id="div">Test text</div> | 87 <div id="div">Test text</div> |
88 </body> | 88 </body> |
89 </html> | 89 </html> |
OLD | NEW |