tor-browser

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

grid-lanes-shorthand-serialization.html (1974B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <title>CSS Grid Lanes: grid-lanes serializes properly when longhands are set</title>
      5  <link rel="author" title="Yanling Wang" href="mailto:yanlingwang@microsoft.com">
      6  <link rel="help" href="https://drafts.csswg.org/css-grid-3">
      7  <script src="/resources/testharness.js"></script>
      8  <script src="/resources/testharnessreport.js"></script>
      9 </head>
     10 <body>
     11  <script>
     12    function testValidGridLanes(gridTemplateRowsValue, gridTemplateColumnsValue, gridTemplateAreasValue, gridLanesDirectionValue, serializedGridLanesValue) {
     13    test(()=>{
     14      const root = document.documentElement;
     15    const properties = [
     16      ["gridTemplateRows", gridTemplateRowsValue],
     17      ["gridTemplateColumns", gridTemplateColumnsValue],
     18      ["gridTemplateAreas", gridTemplateAreasValue],
     19      ["gridLanesDirection", gridLanesDirectionValue],
     20    ];
     21    for (const [property, value] of properties) {
     22      root.style[property] = "";
     23      root.style[property] = value;
     24    }
     25    assert_equals(root.style.gridLanes, serializedGridLanesValue);
     26  }, `grid-template-rows: ${gridTemplateRowsValue},
     27      grid-template-columns: ${gridTemplateColumnsValue},
     28      grid-template-areas: ${gridTemplateAreasValue},
     29      grid-lanes-direction: ${gridLanesDirectionValue} should be valid.`);
     30 }
     31 
     32  testValidGridLanes("none", "none", "none", "column", "none column");
     33  testValidGridLanes("10px", "none", "none", "column", "none column");
     34  testValidGridLanes("10px 20px", "10% 20%", "none", "row", "10px 20px row");
     35  testValidGridLanes("none", "1fr 1fr 3fr", '"a a b"', 'column', '"a a b" 1fr 1fr 3fr column');
     36  testValidGridLanes("20% 40%", "none", '"b" "a"', 'row', '"b a" 20% 40% row');
     37  testValidGridLanes("none", "fit-content(calc(0.5em + 10px))", "none", "column-reverse", "fit-content(calc(0.5em + 10px)) column-reverse");
     38  testValidGridLanes("10% 20% 40%", "none", '"a" "b" "c"', "row-reverse", '"a b c" 10% 20% 40% row-reverse');
     39  </script>
     40 </body>
     41 </html>