tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug414190.html (2619B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=414190
      5 -->
      6 <head>
      7  <title>Test for Bug 414190</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 <body>
     12 
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414190">Mozilla Bug 414190</a>
     14 <p id="display"></p>
     15 
     16 <table id="table" border="0" cellspacing="0" cellpadding="0"
     17       style="width:100px; border:10px solid silver;">
     18  <tr><td id="cell" style="height:100px;"></td></tr>
     19  <caption id="caption" style="caption-side:bottom; width:50px; height:70px; background:yellow;"></caption>
     20 </table>
     21 
     22 <div id="content" style="display: none">
     23 
     24 </div>
     25 <pre id="test">
     26 <script class="testbody" type="text/javascript">
     27 
     28 function isEqualRect(r1, r2, r1border, s) {
     29  is(r1.left + r1border, r2.left, s + " (left)");
     30  is(r1.right - r1border, r2.right, s + " (right)");
     31  is(r1.top + r1border, r2.top, s + " (top)");
     32  is(r1.bottom - r1border, r2.bottom, s + " (bottom)");
     33 }
     34 
     35 function runTest() {
     36  var table = document.getElementById("table");
     37  var cell = document.getElementById("cell");
     38  var caption = document.getElementById("caption");
     39  var tableRects = table.getClientRects();
     40  var tableBoundingRect = table.getBoundingClientRect();
     41  var cellBoundingRect = cell.getBoundingClientRect();
     42  var captionBoundingRect = caption.getBoundingClientRect();
     43 
     44  is(tableRects.length, 2, "Table should have rects for body and caption");
     45  isEqualRect(tableRects[0], cellBoundingRect, 10,
     46              "Table first rect should be cell rect");
     47  isEqualRect(tableRects[1], captionBoundingRect, 0,
     48              "Table second rect should be caption rect");
     49  is(cellBoundingRect.right - cellBoundingRect.left, 80, "Cell incorrect width");
     50  is(cellBoundingRect.bottom - cellBoundingRect.top, 100, "Cell incorrect height");
     51  is(captionBoundingRect.right - captionBoundingRect.left, 50, "Caption incorrect width");
     52  is(captionBoundingRect.bottom - captionBoundingRect.top, 70, "Caption incorrect height");
     53  is(captionBoundingRect.top, cellBoundingRect.bottom + 10, "Discontiguous vertical geometry");
     54 
     55  is(tableBoundingRect.top, cellBoundingRect.top - 10, "Table top error");
     56  is(tableBoundingRect.left, cellBoundingRect.left - 10, "Table left error");
     57  is(tableBoundingRect.bottom, captionBoundingRect.bottom, "Table bottom error");
     58  is(tableBoundingRect.right, cellBoundingRect.right + 10, "Table right error");
     59 
     60  SimpleTest.finish();
     61 }
     62 
     63 SimpleTest.waitForExplicitFinish();
     64 
     65 addLoadEvent(runTest);
     66 </script>
     67 </pre>
     68 </body>
     69 
     70 </html>