summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/bounds/test_list.html
blob: 38a79689b6c714ca8d276b8f47877a69721de229 (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
<!DOCTYPE html>
<html>
<head>
  <title>Accessible boundaries when page is zoomed</title>
  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../role.js"></script>
  <script type="application/javascript"
          src="../layout.js"></script>

  <script type="application/javascript">
    function doTest()
    {
      // Inside list
      var li = getAccessible("insidelist_item");
      testBounds(li);

      var [xLI, yLI, widthLI, heightLI] = getBounds(li);
      var bullet = li.firstChild;
      var [x, y, width, height] = getBounds(bullet);
      is(x, xLI,
        "Bullet x should match to list item x");
      ok(y >= yLI,
         "Bullet y= " + y + " should be not less than list item y=" + yLI);
      ok(width < widthLI,
         "Bullet width should be lesser list item width");
      ok(height <= heightLI,
         "Bullet height= " + height + " should be not greater than list item height=" + heightLI);

      // Outside list
      li = getAccessible("outsidelist_item");
      var [xLIElm, yLIElm, widthLIElm, heightLIElm] = getBoundsForDOMElm(li);
      [xLI, yLI, widthLI, heightLI] = getBounds(li);

      ok(xLI < xLIElm,
         "Outside list item x=" + xLI + " should be lesser than list item element x=" + xLIElm);
      is(yLI, yLIElm,
         "Outside list item y should match to list item element y");
      ok(widthLI > widthLIElm,
         "Outside list item width=" + widthLI + " should be greater than list item element width=" + widthLIElm);
      is(heightLI, heightLIElm,
         "Outside list item height should match to list item element height");

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>
<body>

  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=754627"
     title="GetBounds on bullet return wrong values">
    Mozilla Bug 754627
  </a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <ul style="list-style-position: inside;">
    <li id="insidelist_item">item</li>
  </ul>

  <ul style="list-style-position: outside;">
    <li id="outsidelist_item">item</li>
  </ul>

</body>
</html>