tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_rules_edit-variable.js (1097B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test editing a CSS variable.
      7 
      8 const TEST_URI = `
      9  <style type='text/css'>
     10    div {
     11      color: var(--color);
     12      --color: lime;
     13    }
     14  </style>
     15  <div></div>
     16 `;
     17 
     18 add_task(async function () {
     19  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     20  const { inspector, view } = await openRuleView();
     21  await selectNode("div", inspector);
     22 
     23  info("Check the initial state of the --color variable");
     24  checkCSSVariableOutput(view, "div", "color", "inspector-variable", "lime");
     25 
     26  info("Edit the CSS variable");
     27  const prop = getTextProperty(view, 1, { "--color": "lime" });
     28  const propEditor = prop.editor;
     29  const editor = await focusEditableField(view, propEditor.valueSpan);
     30  editor.input.value = "blue";
     31  const onRuleViewChanged = view.once("ruleview-changed");
     32  EventUtils.synthesizeKey("VK_RETURN", {}, view.styleWindow);
     33  await onRuleViewChanged;
     34  checkCSSVariableOutput(view, "div", "color", "inspector-variable", "blue");
     35 });