tor-browser

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

browser_rules_mathml-element.js (1920B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Tests that the rule-view displays correctly on MathML elements.
      7 
      8 const TEST_URI = `
      9  <style>
     10    div {
     11      background-color: hotpink;
     12    }
     13 
     14    math {
     15      font-size: 36px;
     16    }
     17 
     18    msubsup {
     19      background-color: tomato;
     20    }
     21  </style>
     22  <div>
     23    <math>
     24      <mfrac>
     25        <msubsup>
     26          <mi>a</mi>
     27          <mi>i</mi>
     28          <mi>j</mi>
     29        </msubsup>
     30        <msub>
     31          <mi>x</mi>
     32          <mn style="color: gold;">0</mn>
     33        </msub>
     34      </mfrac>
     35    </math>
     36  </div>
     37 `;
     38 
     39 add_task(async function () {
     40  await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
     41  const { inspector, view } = await openRuleView();
     42 
     43  info("Select the DIV node and verify the rule-view shows rules");
     44  await selectNode("div", inspector);
     45  is(
     46    getRuleViewPropertyValue(view, "div", "background-color"),
     47    "hotpink",
     48    "background-color in div rule has expected value"
     49  );
     50 
     51  info("Select various MathML nodes and check that rules are displayed");
     52  await selectNode("math", inspector);
     53  is(
     54    getRuleViewPropertyValue(view, "math", "font-size"),
     55    "36px",
     56    "font-size in math rule has expected value"
     57  );
     58 
     59  await selectNode("msubsup", inspector);
     60  is(
     61    getRuleViewPropertyValue(view, "msubsup", "background-color"),
     62    "tomato",
     63    "background-color in msubsup rule has expected value"
     64  );
     65 
     66  await selectNode("mn", inspector);
     67  is(
     68    getRuleViewPropertyValue(view, "element", "color"),
     69    "gold",
     70    "color in mn element style has expected value"
     71  );
     72 
     73  info("Select again the DIV node and verify the rule-view shows rules");
     74  await selectNode("div", inspector);
     75  is(
     76    getRuleViewPropertyValue(view, "div", "background-color"),
     77    "hotpink",
     78    "background-color in div rule still has expected value"
     79  );
     80 });