michael@0: /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
michael@0: /* Any copyright is dedicated to the Public Domain.
michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0:
michael@0: "use strict";
michael@0:
michael@0: // Test that the computed view refreshes when the current node has its style
michael@0: // changed, even if the view is not the active one
michael@0:
michael@0: const TESTCASE_URI = 'data:text/html;charset=utf-8,' +
michael@0: '
Test div!
';
michael@0:
michael@0: let test = asyncTest(function*() {
michael@0: yield addTab(TESTCASE_URI);
michael@0:
michael@0: info("Getting the test node");
michael@0: let div = getNode("#testdiv");
michael@0:
michael@0: info("Opening the computed view and selecting the test node");
michael@0: let {toolbox, inspector, view} = yield openComputedView();
michael@0: yield selectNode(div, inspector);
michael@0:
michael@0: let fontSize = getComputedViewPropertyValue(view, "font-size");
michael@0: is(fontSize, "10px", "The computed view shows the right font-size");
michael@0:
michael@0: info("Now switching to the rule view");
michael@0: yield openRuleView();
michael@0:
michael@0: info("Changing the node's style and waiting for the update");
michael@0: let onUpdated = inspector.once("computed-view-refreshed");
michael@0: div.style.cssText = "font-size: 20px; color: blue; text-align: center";
michael@0: yield onUpdated;
michael@0:
michael@0: fontSize = getComputedViewPropertyValue(view, "font-size");
michael@0: is(fontSize, "20px", "The computed view shows the updated font-size");
michael@0: let color = getComputedViewPropertyValue(view, "color");
michael@0: is(color, "#00F", "The computed view also shows the color now");
michael@0: let textAlign = getComputedViewPropertyValue(view, "text-align");
michael@0: is(textAlign, "center", "The computed view also shows the text-align now");
michael@0: });