browser/devtools/styleinspector/test/browser_ruleview_refresh-on-style-change.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/ */
     5 "use strict";
     7 // Test that the rule view refreshes when the current node has its style
     8 // changed
    10 const TESTCASE_URI = 'data:text/html;charset=utf-8,' +
    11                      '<div id="testdiv" style="font-size:10px;">Test div!</div>';
    13 let test = asyncTest(function*() {
    14   yield addTab(TESTCASE_URI);
    16   Services.prefs.setCharPref("devtools.defaultColorUnit", "name");
    18   info("Getting the test node");
    19   let div = getNode("#testdiv");
    21   info("Opening the rule view and selecting the test node");
    22   let {toolbox, inspector, view} = yield openRuleView();
    23   yield selectNode(div, inspector);
    25   let fontSize = getRuleViewPropertyValue(view, "element", "font-size");
    26   is(fontSize, "10px", "The rule view shows the right font-size");
    28   info("Changing the node's style and waiting for the update");
    29   let onUpdated = inspector.once("rule-view-refreshed");
    30   div.style.cssText = "font-size: 3em; color: lightgoldenrodyellow; text-align: right; text-transform: uppercase";
    31   yield onUpdated;
    33   let textAlign = getRuleViewPropertyValue(view, "element", "text-align");
    34   is(textAlign, "right", "The rule view shows the new text align.");
    35   let color = getRuleViewPropertyValue(view, "element", "color");
    36   is(color, "lightgoldenrodyellow", "The rule view shows the new color.")
    37   let fontSize = getRuleViewPropertyValue(view, "element", "font-size");
    38   is(fontSize, "3em", "The rule view shows the new font size.");
    39   let textTransform = getRuleViewPropertyValue(view, "element", "text-transform");
    40   is(textTransform, "uppercase", "The rule view shows the new text transform.");
    41 });

mercurial