summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mathml/relations/css-styling/displaystyle-3.html
blob: a5bcab2aaa7e6ef4a853afae9e5040e8278947f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>displaystyle</title>
<link rel="help" href="https://w3c.github.io/mathml-core/#css-styling">
<link rel="help" href="https://w3c.github.io/mathml-core/#the-displaystyle-and-scriptlevel-attributes">
<link rel="help" href="https://w3c.github.io/mathml-core/#the-math-style-property">
<meta name="assert" content="Verify the displaystyle of the underover element is considered (not the one of its base) to determine whether to move limits.">
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
  math, math *  {
    font-family: Ahem;
    font-size: 20px;
  }
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/feature-detection.js"></script>
<script src="/mathml/support/fonts.js"></script>
<script>
  setup({ explicit_done: true });
  window.addEventListener("load", () => { loadAllFonts().then(runTests); });
  function runTests() {
      ["munder", "mover", "munderover"].forEach((tag) => {
          Array.from(document.getElementsByTagName(tag)).forEach(e => {
              var displaystyle = e.getAttribute('displaystyle') === "true";
              test(function() {
                  assert_true(MathMLFeatureDetection.has_movablelimits());
                  var elementRight = e.getBoundingClientRect().right;
                  var baseRight = e.firstElementChild.getBoundingClientRect().right;
                  if (displaystyle)
                      assert_approx_equals(elementRight, baseRight, 1);
                  else
                      assert_greater_than(elementRight, baseRight + 10);
              }, `movablelimits for ${tag} element (displaystyle=${displaystyle})`);
          });
      });
      done();
  }
</script>
</head>
<body>
  <div id="log"></div>
  <math>
    <munder displaystyle="false">
      <mo displaystyle="true" movablelimits="true">XX</mo>
      <mtext>X</mtext>
    </munder>
  </math>
  <math>
    <mover displaystyle="false">
      <mo displaystyle="true" movablelimits="true">XX</mo>
      <mtext>X</mtext>
    </mover>
  </math>
  <math>
    <munderover displaystyle="false">
      <mo displaystyle="true" movablelimits="true">XX</mo>
      <mtext>X</mtext>
      <mtext>X</mtext>
    </munderover>
  </math>
  <math>
    <munder displaystyle="true">
      <mo displaystyle="false" movablelimits="true">XX</mo>
      <mtext>X</mtext>
    </munder>
  </math>
  <math>
    <mover displaystyle="true">
      <mo displaystyle="false" movablelimits="true">XX</mo>
      <mtext>X</mtext>
    </mover>
  </math>
  <math>
    <munderover displaystyle="true">
      <mo displaystyle="false" movablelimits="true">XX</mo>
      <mtext>X</mtext>
      <mtext>X</mtext>
    </munderover>
  </math>
</body>
</html>