tor-browser

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

grid-template-columns-computed-withcontent.html (5416B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="utf-8">
      5 <title>CSS Grid Layout Test: getComputedStyle().gridTemplateColumns</title>
      6 <link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template-columns">
      7 <meta name="assert" content="grid-template-columns computed value is the keyword none or a computed track list.">
      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  #target {
     13    display: grid;
     14    font-size: 40px;
     15    min-width: 200px;
     16    width: 300px;
     17    max-width: 400px;
     18    min-height: 500px;
     19    height: 600px;
     20    max-height: 700px;
     21  }
     22  #child {
     23    min-width: 20px;
     24    width: 30px;
     25    max-width: 40px;
     26    min-height: 50px;
     27    height: 60px;
     28    max-height: 70px;
     29  }
     30 </style>
     31 </head>
     32 <body>
     33 <div id="container">
     34  <div id="target">
     35    <div id="child"></div>
     36  </div>
     37 </div>
     38 <script>
     39 test_computed_value("grid-template-columns", 'none', '300px'); // "none" without #child
     40 
     41 // track-size <fixed-breadth> = <length-percentage> | <flex> | min-content | max-content | auto
     42 test_computed_value("grid-template-columns", '20%', '60px'); // 20% * width
     43 test_computed_value("grid-template-columns", 'calc(-0.5em + 10px)', '0px');
     44 test_computed_value("grid-template-columns", 'calc(0.5em + 10px)', '30px');
     45 test_computed_value("grid-template-columns", 'calc(30% + 40px)', '130px'); // 30% * width + 40px
     46 test_computed_value("grid-template-columns", '5fr', '300px'); // width
     47 test_computed_value("grid-template-columns", 'min-content', '30px');
     48 test_computed_value("grid-template-columns", 'max-content', '30px');
     49 test_computed_value("grid-template-columns", 'auto', '300px'); // width
     50 
     51 // track-size minmax( <inflexible-breadth> , <track-breadth> )
     52 test_computed_value("grid-template-columns", 'minmax(10px, auto)', '300px'); // width
     53 test_computed_value("grid-template-columns", 'minmax(20%, max-content)', '60px'); // 20% * width
     54 test_computed_value("grid-template-columns", 'minmax(min-content, calc(-0.5em + 10px))', '30px');
     55 test_computed_value("grid-template-columns", 'minmax(auto, 0)', '30px');
     56 
     57 // track-size fit-content( <length-percentage> )
     58 test_computed_value("grid-template-columns", 'fit-content(70px)', '30px');
     59 test_computed_value("grid-template-columns", 'fit-content(20%)', '30px');
     60 test_computed_value("grid-template-columns", 'fit-content(calc(-0.5em + 10px))', '30px');
     61 
     62 // <track-repeat> = repeat( [ <positive-integer> ] , [ <line-names>? <track-size> ]+ <line-names>? )
     63 test_computed_value("grid-template-columns", 'repeat(1, 10px)', '10px');
     64 test_computed_value("grid-template-columns", 'repeat(1, [one two] 20%)', '[one two] 60px');
     65 test_computed_value("grid-template-columns", 'repeat(2, minmax(10px, auto))', '160px 140px');
     66 
     67 test_computed_value("grid-template-columns", 'repeat(2, fit-content(20%) [three four] 30px 40px [five six])',
     68                    '30px [three four] 30px 40px [five six] 0px [three four] 30px 40px [five six]');
     69 
     70 // <track-list> = [ <line-names>? [ <track-size> | <track-repeat> ] ]+ <line-names>?
     71 test_computed_value("grid-template-columns", 'min-content repeat(5, minmax(10px, auto))',
     72                    '30px 54px 54px 54px 54px 54px');
     73 test_computed_value("grid-template-columns", '[] 150px [] 1fr []', '150px 150px');
     74 
     75 // <auto-repeat> = repeat( [ auto-fill | auto-fit ] , [ <line-names>? <fixed-size> ]+ <line-names>? )
     76 test_computed_value("grid-template-columns", 'repeat(auto-fill, 200px)', '200px');
     77 test_computed_value("grid-template-columns", 'repeat(auto-fit, [one] 20%)',
     78                    '[one] 60px [one] 0px [one] 0px [one] 0px [one] 0px');
     79 test_computed_value("grid-template-columns", 'repeat(auto-fill, minmax(100px, 5fr) [two])',
     80                    '100px [two] 100px [two] 100px [two]');
     81 test_computed_value("grid-template-columns", 'repeat(auto-fit, [three] minmax(max-content, 6em) [four])',
     82                    '[three] 240px [four]');
     83 test_computed_value('grid-template-columns', '[a] 21px [b] repeat(auto-fill, [c] 22px [d] 23px [e]) [f] 24px [g]',
     84                    '[a] 21px [b c] 22px [d] 23px [e c] 22px [d] 23px [e c] 22px [d] 23px [e c] 22px [d] 23px [e c] 22px [d] 23px [e f] 24px [g]');
     85 test_computed_value('grid-template-columns', '[a] 21px [b c] repeat(auto-fill, [d e] 22px [f g h] 23px [i j k l]) [m n] 24px [o]',
     86                    '[a] 21px [b c d e] 22px [f g h] 23px [i j k l d e] 22px [f g h] 23px [i j k l d e] 22px [f g h] 23px [i j k l d e] 22px [f g h] 23px [i j k l d e] 22px [f g h] 23px [i j k l m n] 24px [o]');
     87 test_computed_value('grid-template-columns', '[a] repeat(2, [b] 20px [c d] 21px [e f g]) [h i] repeat(auto-fit, [j] 22px [k l m] 23px [n o p q]) [r s]',
     88                    '[a b] 20px [c d] 21px [e f g b] 20px [c d] 21px [e f g h i j] 0px [k l m] 0px [n o p q j] 0px [k l m] 0px [n o p q j] 0px [k l m] 0px [n o p q j] 0px [k l m] 0px [n o p q r s]');
     89 
     90 // <auto-track-list> =
     91 // [ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?
     92 // <auto-repeat>
     93 // [ <line-names>? [ <fixed-size> | <fixed-repeat> ] ]* <line-names>?
     94 
     95 test_computed_value("grid-template-columns", '[one] repeat(2, minmax(50px, auto)) [two] 30px [three] repeat(auto-fill, 10px) 40px [four five] repeat(2, minmax(200px, auto)) [six]',
     96                    '[one] 50px 50px [two] 30px [three] 10px 40px [four five] 200px 200px [six]');
     97 </script>
     98 </body>
     99 </html>