summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/rules/test/browser_rules_add-rule-and-property.js
blob: ddb99464e8799c394b5ea871d7e566e0e50d7a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Tests adding a new rule and a new property in this rule.

add_task(async function () {
  await addTab(
    "data:text/html;charset=utf-8,<div id='testid'>Styled Node</div>"
  );
  const { inspector, view } = await openRuleView();

  info("Selecting the test node");
  await selectNode("#testid", inspector);

  info("Adding a new rule for this node and blurring the new selector field");
  await addNewRuleAndDismissEditor(inspector, view, "#testid", 1);

  info("Adding a new property for this rule");
  const ruleEditor = getRuleViewRuleEditor(view, 1);

  const onRuleViewChanged = view.once("ruleview-changed");
  ruleEditor.addProperty("font-weight", "bold", "", true);
  await onRuleViewChanged;

  const textProps = ruleEditor.rule.textProps;
  const prop = textProps[textProps.length - 1];
  is(prop.name, "font-weight", "The last property name is font-weight");
  is(prop.value, "bold", "The last property value is bold");
});