tor-browser

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

browser_rules_lineNumbers.js (1012B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that editing a rule will update the line numbers of subsequent
      7 // rules in the rule view.
      8 
      9 const TESTCASE_URI = URL_ROOT + "doc_ruleLineNumbers.html";
     10 
     11 add_task(async function () {
     12  await addTab(TESTCASE_URI);
     13  const { inspector, view } = await openRuleView();
     14  await selectNode("#testid", inspector);
     15 
     16  const bodyRuleEditor = getRuleViewRuleEditor(view, 3);
     17  const value = getRuleViewLinkTextByIndex(view, 2);
     18  // Note that this is relative to the <style>.
     19  is(value.slice(-2), ":6", "initial rule line number is 6");
     20 
     21  const onLocationChanged = once(
     22    bodyRuleEditor.rule.domRule,
     23    "location-changed"
     24  );
     25  await addProperty(view, 1, "font-size", "23px");
     26  await onLocationChanged;
     27 
     28  const newBodyTitle = getRuleViewLinkTextByIndex(view, 2);
     29  // Note that this is relative to the <style>.
     30  is(newBodyTitle.slice(-2), ":7", "updated rule line number is 7");
     31 });