Skip to content

Commit

Permalink
Update MathML tests for embellished operators.
Browse files Browse the repository at this point in the history
This commit updates tests after [1] [2]:

* merror, mprescripts, none, unknown are now treated as other mrow-like
  elements.
* maction and semantics are moved into a separate file and new tests
  added now that they are mrow-like elements with some hidden children.

[1] w3c/mathml#182
[2] w3c/mathml#183
  • Loading branch information
fred-wang committed Mar 21, 2020
1 parent f2c1dfe commit 54e99e1
Show file tree
Hide file tree
Showing 3 changed files with 611 additions and 121 deletions.
216 changes: 214 additions & 2 deletions mathml/presentation-markup/operators/embellished-operator-001.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
var epsilon = 1;
var emToPx = 25;

["mrow", "mstyle", "mphantom", "mpadded"].forEach(tag => {
["mrow", "mstyle", "mphantom", "mpadded", "merror", "mprescripts", "none", "unknown"].forEach(tag => {
test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
assert_approx_equals(spaceBeforeElement(`${tag}-op-1`), 2 * emToPx, epsilon);
Expand Down Expand Up @@ -252,7 +252,7 @@
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<!-- mpadded is an embellished operator if its children consist
<!-- mpadded is an embellished operator if its in-flow children consist
of one embellished operator and zero or more space-like elements. -->
<p>
<math>
Expand Down Expand Up @@ -305,5 +305,217 @@
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<!-- merror is an embellished operator if its in-flow children consist
of one embellished operator and zero or more space-like elements. -->
<p>
<math>
<mn>X</mn>
<merror id="merror-op-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
</merror>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn>X</mn>
<merror id="merror-nonop-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
<mn>X</mn> <!-- "mn" is not space-like -->
</merror>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<merror id="merror-op-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</merror>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<merror id="merror-nonop-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn> <!-- "mn" is not space-like -->
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</merror>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<!-- mprescripts is an embellished operator if its in-flow children consist
of one embellished operator and zero or more space-like elements. -->
<p>
<math>
<mn>X</mn>
<mprescripts id="mprescripts-op-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
</mprescripts>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn>X</mn>
<mprescripts id="mprescripts-nonop-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
<mn>X</mn> <!-- "mn" is not space-like -->
</mprescripts>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mprescripts id="mprescripts-op-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</mprescripts>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mprescripts id="mprescripts-nonop-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn> <!-- "mn" is not space-like -->
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</mprescripts>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<!-- none is an embellished operator if its in-flow children consist
of one embellished operator and zero or more space-like elements. -->
<p>
<math>
<mn>X</mn>
<none id="none-op-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
</none>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn>X</mn>
<none id="none-nonop-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
<mn>X</mn> <!-- "mn" is not space-like -->
</none>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<none id="none-op-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</none>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<none id="none-nonop-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn> <!-- "mn" is not space-like -->
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</none>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<!-- unknown is an embellished operator if its in-flow children consist
of one embellished operator and zero or more space-like elements. -->
<p>
<math>
<mn>X</mn>
<unknown id="unknown-op-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
</unknown>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn>X</mn>
<unknown id="unknown-nonop-1" class="testedElement">
<mo lspace="2em" rspace="0em">X</mo>
<mn>X</mn> <!-- "mn" is not space-like -->
</unknown>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<unknown id="unknown-op-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</unknown>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
<p>
<math>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<unknown id="unknown-nonop-2" class="testedElement">
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mo lspace="2em" rspace="0em">X</mo>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn> <!-- "mn" is not space-like -->
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</unknown>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
<mn>X</mn>
<mn class="oof1">0</mn><mn class="oof2">1</mn><mn class="nobox">2</mn>
</math>
</p>
</body>
</html>
Loading

0 comments on commit 54e99e1

Please sign in to comment.