|
1 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ |
|
2 /* Any copyright is dedicated to the Public Domain. |
|
3 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
4 |
|
5 "use strict"; |
|
6 |
|
7 // Test that the computed view refreshes when the current node has its style |
|
8 // changed, even if the view is not the active one |
|
9 |
|
10 const TESTCASE_URI = 'data:text/html;charset=utf-8,' + |
|
11 '<div id="testdiv" style="font-size:10px;">Test div!</div>'; |
|
12 |
|
13 let test = asyncTest(function*() { |
|
14 yield addTab(TESTCASE_URI); |
|
15 |
|
16 info("Getting the test node"); |
|
17 let div = getNode("#testdiv"); |
|
18 |
|
19 info("Opening the computed view and selecting the test node"); |
|
20 let {toolbox, inspector, view} = yield openComputedView(); |
|
21 yield selectNode(div, inspector); |
|
22 |
|
23 let fontSize = getComputedViewPropertyValue(view, "font-size"); |
|
24 is(fontSize, "10px", "The computed view shows the right font-size"); |
|
25 |
|
26 info("Now switching to the rule view"); |
|
27 yield openRuleView(); |
|
28 |
|
29 info("Changing the node's style and waiting for the update"); |
|
30 let onUpdated = inspector.once("computed-view-refreshed"); |
|
31 div.style.cssText = "font-size: 20px; color: blue; text-align: center"; |
|
32 yield onUpdated; |
|
33 |
|
34 fontSize = getComputedViewPropertyValue(view, "font-size"); |
|
35 is(fontSize, "20px", "The computed view shows the updated font-size"); |
|
36 let color = getComputedViewPropertyValue(view, "color"); |
|
37 is(color, "#00F", "The computed view also shows the color now"); |
|
38 let textAlign = getComputedViewPropertyValue(view, "text-align"); |
|
39 is(textAlign, "center", "The computed view also shows the text-align now"); |
|
40 }); |