tor-browser

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

border-width-computed.html (2077B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>CSS Backgrounds and Borders: getComputedStyle().borderWidth</title>
      6 <link rel="help" href="https://drafts.csswg.org/css-backgrounds/#border-width">
      7 <meta name="assert" content="border-width computed value is the absolute length; zero if the border style is none or hidden.">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/css/support/computed-testcommon.js"></script>
     11 <style>
     12  #box {
     13    border-style: dotted; /* Avoid border-*-width computed style 0 */
     14    border-top-width: thin;
     15    border-right-width: medium;
     16    border-bottom-width: thick;
     17  }
     18  #target {
     19    border-style: dotted; /* Avoid border-*-width computed style 0 */
     20    font-size: 40px;
     21  }
     22 </style>
     23 </head>
     24 <body>
     25 <div id="box"></div>
     26 <div id="target"></div>
     27 <script>
     28 'use strict';
     29 const box = document.getElementById('box');
     30 const thinWidth = getComputedStyle(box).borderTopWidth;
     31 const mediumWidth = getComputedStyle(box).borderRightWidth;
     32 const thickWidth = getComputedStyle(box).borderBottomWidth;
     33 
     34 test_computed_value("border-width", "1px");
     35 test_computed_value("border-width", "1px 2px");
     36 test_computed_value("border-width", "1px 2px 3px");
     37 test_computed_value("border-width", "1px 2px 3px 4px");
     38 
     39 test_computed_value("border-width", "0.5em", "20px");
     40 test_computed_value("border-width", "2px thin medium thick", "2px " + thinWidth + " " + mediumWidth + " " + thickWidth);
     41 
     42 test_computed_value("border-top-width", "0px");
     43 test_computed_value("border-right-width", "10px");
     44 test_computed_value("border-bottom-width", "calc(-0.5em + 10px)", "0px");
     45 test_computed_value("border-left-width", "calc(0.5em + 10px)", "30px");
     46 
     47 test(() => {
     48  const thin = Number(thinWidth.replace("px", ""));
     49  const medium = Number(mediumWidth.replace("px", ""));
     50  const thick = Number(thickWidth.replace("px", ""));
     51  assert_less_than_equal(0, thin);
     52  assert_less_than_equal(thin, medium);
     53  assert_less_than_equal(medium, thick);
     54 }, "thin ≤ medium ≤ thick");
     55 </script>
     56 </body>
     57 </html>