browser/devtools/styleinspector/test/browser_ruleview_mathml-element.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
michael@0 2 /* Any copyright is dedicated to the Public Domain.
michael@0 3 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 4
michael@0 5 "use strict";
michael@0 6
michael@0 7 // Tests that the rule-view displays correctly on MathML elements
michael@0 8
michael@0 9 const TEST_URL = [
michael@0 10 "data:text/html,",
michael@0 11 "<div>",
michael@0 12 " <math xmlns=\"http://www.w3.org/1998/Math/MathML\">",
michael@0 13 " <mfrac>",
michael@0 14 " <msubsup>",
michael@0 15 " <mi>a</mi>",
michael@0 16 " <mi>i</mi>",
michael@0 17 " <mi>j</mi>",
michael@0 18 " </msubsup>",
michael@0 19 " <msub>",
michael@0 20 " <mi>x</mi>",
michael@0 21 " <mn>0</mn>",
michael@0 22 " </msub>",
michael@0 23 " </mfrac>",
michael@0 24 " </math>",
michael@0 25 "</div>"
michael@0 26 ].join("");
michael@0 27
michael@0 28 let test = asyncTest(function*() {
michael@0 29 yield addTab(TEST_URL);
michael@0 30 let {toolbox, inspector, view} = yield openRuleView();
michael@0 31
michael@0 32 info("Select the DIV node and verify the rule-view shows rules");
michael@0 33 yield selectNode("div", inspector);
michael@0 34 ok(view.element.querySelectorAll(".ruleview-rule").length,
michael@0 35 "The rule-view shows rules for the div element");
michael@0 36
michael@0 37 info("Select various MathML nodes and verify the rule-view is empty");
michael@0 38 yield selectNode("math", inspector);
michael@0 39 ok(!view.element.querySelectorAll(".ruleview-rule").length,
michael@0 40 "The rule-view is empty for the math element");
michael@0 41
michael@0 42 yield selectNode("msubsup", inspector);
michael@0 43 ok(!view.element.querySelectorAll(".ruleview-rule").length,
michael@0 44 "The rule-view is empty for the msubsup element");
michael@0 45
michael@0 46 yield selectNode("mn", inspector);
michael@0 47 ok(!view.element.querySelectorAll(".ruleview-rule").length,
michael@0 48 "The rule-view is empty for the mn element");
michael@0 49
michael@0 50 info("Select again the DIV node and verify the rule-view shows rules");
michael@0 51 yield selectNode("div", inspector);
michael@0 52 ok(view.element.querySelectorAll(".ruleview-rule").length,
michael@0 53 "The rule-view shows rules for the div element");
michael@0 54 });

mercurial