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 rule view refreshes when the current node has its style michael@0: // changed 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: Services.prefs.setCharPref("devtools.defaultColorUnit", "name"); michael@0: michael@0: info("Getting the test node"); michael@0: let div = getNode("#testdiv"); michael@0: michael@0: info("Opening the rule view and selecting the test node"); michael@0: let {toolbox, inspector, view} = yield openRuleView(); michael@0: yield selectNode(div, inspector); michael@0: michael@0: let fontSize = getRuleViewPropertyValue(view, "element", "font-size"); michael@0: is(fontSize, "10px", "The rule view shows the right font-size"); michael@0: michael@0: info("Changing the node's style and waiting for the update"); michael@0: let onUpdated = inspector.once("rule-view-refreshed"); michael@0: div.style.cssText = "font-size: 3em; color: lightgoldenrodyellow; text-align: right; text-transform: uppercase"; michael@0: yield onUpdated; michael@0: michael@0: let textAlign = getRuleViewPropertyValue(view, "element", "text-align"); michael@0: is(textAlign, "right", "The rule view shows the new text align."); michael@0: let color = getRuleViewPropertyValue(view, "element", "color"); michael@0: is(color, "lightgoldenrodyellow", "The rule view shows the new color.") michael@0: let fontSize = getRuleViewPropertyValue(view, "element", "font-size"); michael@0: is(fontSize, "3em", "The rule view shows the new font size."); michael@0: let textTransform = getRuleViewPropertyValue(view, "element", "text-transform"); michael@0: is(textTransform, "uppercase", "The rule view shows the new text transform."); michael@0: });