Skip to content

Commit

Permalink
Update space-like tests. (#21568)
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-wang authored Feb 4, 2020
1 parent f885d33 commit 56c5d89
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 18 deletions.
41 changes: 41 additions & 0 deletions mathml/presentation-markup/spaces/space-like-001.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@
assert_approx_equals(spaceAfter("mpadded2"), 2 * emToPx, epsilon);
}, "non-space-like mpadded");

test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
assert_approx_equals(spaceBefore("merror1"), emToPx, epsilon);
assert_approx_equals(spaceAfter("merror1"), emToPx, epsilon);
}, "space-like merror");

test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
assert_approx_equals(spaceBefore("merror2"), 0, epsilon);
assert_approx_equals(spaceAfter("merror2"), 2 * emToPx, epsilon);
}, "non-space-like merror");

done();
}
</script>
Expand Down Expand Up @@ -253,5 +265,34 @@
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn>X</mn>
<mrow>
<!-- merror is space-like when it contains only space-like elements. -->
<merror id="merror1" class="testedElement">
<mtext>X</mtext>
<mspace width="25px" height="10px"></mspace>
</merror>
<mo lspace="1em" rspace="0em">X</mo>
</mrow>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn>X</mn>
<mrow>
<!-- merror is not space-like when it contains a non space-like element
such as "mn". -->
<merror id="merror2" class="testedElement">
<mn>X</mn>
<mspace width="25px" height="10px"></mspace>
</merror>
<mo lspace="1em" rspace="0em">X</mo>
</mrow>
<mn>X</mn>
</math>
</p>
</body>
</html>
12 changes: 6 additions & 6 deletions mathml/presentation-markup/spaces/space-like-002.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@

test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
assert_approx_equals(spaceBefore("maction2"), 0, epsilon);
assert_approx_equals(spaceAfter("maction2"), 2 * emToPx, epsilon);
}, "non-space like maction (no first child)");
assert_approx_equals(spaceBefore("maction2"), emToPx, epsilon);
assert_approx_equals(spaceAfter("maction2"), emToPx, epsilon);
}, "space-like maction (no first child)");

test(function() {
assert_approx_equals(spaceBefore("maction3"), 0, epsilon);
Expand All @@ -74,9 +74,9 @@

test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
assert_approx_equals(spaceBefore("semantics2"), 0, epsilon);
assert_approx_equals(spaceAfter("semantics2"), 2 * emToPx, epsilon);
}, "non-space like semantics (no first child)");
assert_approx_equals(spaceBefore("semantics2"), emToPx, epsilon);
assert_approx_equals(spaceAfter("semantics2"), emToPx, epsilon);
}, "space-like semantics (no first child)");

test(function() {
assert_true(MathMLFeatureDetection.has_operator_spacing());
Expand Down
12 changes: 0 additions & 12 deletions mathml/presentation-markup/spaces/space-like-003.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@
</head>
<body>
<div id="log"></div>
<p>
<math>
<mn>X</mn>
<mrow>
<merror class="testedElement">
<mtext>X</mtext>
</merror>
<mo lspace="1em" rspace="0em">X</mo>
</mrow>
<mn>X</mn>
</math>
</p>
<p>
<math>
<mn>X</mn>
Expand Down

0 comments on commit 56c5d89

Please sign in to comment.