Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ |
michael@0 | 2 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | // Test that the rule view refreshes when the current node has its style |
michael@0 | 8 | // changed |
michael@0 | 9 | |
michael@0 | 10 | const TESTCASE_URI = 'data:text/html;charset=utf-8,' + |
michael@0 | 11 | '<div id="testdiv" style="font-size:10px;">Test div!</div>'; |
michael@0 | 12 | |
michael@0 | 13 | let test = asyncTest(function*() { |
michael@0 | 14 | yield addTab(TESTCASE_URI); |
michael@0 | 15 | |
michael@0 | 16 | Services.prefs.setCharPref("devtools.defaultColorUnit", "name"); |
michael@0 | 17 | |
michael@0 | 18 | info("Getting the test node"); |
michael@0 | 19 | let div = getNode("#testdiv"); |
michael@0 | 20 | |
michael@0 | 21 | info("Opening the rule view and selecting the test node"); |
michael@0 | 22 | let {toolbox, inspector, view} = yield openRuleView(); |
michael@0 | 23 | yield selectNode(div, inspector); |
michael@0 | 24 | |
michael@0 | 25 | let fontSize = getRuleViewPropertyValue(view, "element", "font-size"); |
michael@0 | 26 | is(fontSize, "10px", "The rule view shows the right font-size"); |
michael@0 | 27 | |
michael@0 | 28 | info("Changing the node's style and waiting for the update"); |
michael@0 | 29 | let onUpdated = inspector.once("rule-view-refreshed"); |
michael@0 | 30 | div.style.cssText = "font-size: 3em; color: lightgoldenrodyellow; text-align: right; text-transform: uppercase"; |
michael@0 | 31 | yield onUpdated; |
michael@0 | 32 | |
michael@0 | 33 | let textAlign = getRuleViewPropertyValue(view, "element", "text-align"); |
michael@0 | 34 | is(textAlign, "right", "The rule view shows the new text align."); |
michael@0 | 35 | let color = getRuleViewPropertyValue(view, "element", "color"); |
michael@0 | 36 | is(color, "lightgoldenrodyellow", "The rule view shows the new color.") |
michael@0 | 37 | let fontSize = getRuleViewPropertyValue(view, "element", "font-size"); |
michael@0 | 38 | is(fontSize, "3em", "The rule view shows the new font size."); |
michael@0 | 39 | let textTransform = getRuleViewPropertyValue(view, "element", "text-transform"); |
michael@0 | 40 | is(textTransform, "uppercase", "The rule view shows the new text transform."); |
michael@0 | 41 | }); |