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