grid-container-properties.mjs (1633B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // InactivePropertyHelper test cases: 6 // `grid-auto-columns`, `grid-auto-flow`, `grid-auto-rows`, `grid-template`, 7 // `grid-template-areas`, `grid-template-columns`, `grid-template-rows`, 8 // and `justify-items`. 9 let tests = []; 10 11 for (const { propertyName, propertyValue } of [ 12 { propertyName: "grid-auto-columns", propertyValue: "100px" }, 13 { propertyName: "grid-auto-flow", propertyValue: "columns" }, 14 { propertyName: "grid-auto-rows", propertyValue: "100px" }, 15 { propertyName: "grid-template", propertyValue: "auto / auto" }, 16 { propertyName: "grid-template-areas", propertyValue: "a b c" }, 17 { propertyName: "grid-template-columns", propertyValue: "100px 1fr" }, 18 { propertyName: "grid-template-rows", propertyValue: "100px 1fr" }, 19 { propertyName: "justify-items", propertyValue: "center" }, 20 ]) { 21 tests = tests.concat(createTestsForProp(propertyName, propertyValue)); 22 } 23 24 function createTestsForProp(propertyName, propertyValue) { 25 return [ 26 { 27 info: `${propertyName} is active on a grid container`, 28 property: propertyName, 29 tagName: "div", 30 rules: [`div { display:grid; ${propertyName}: ${propertyValue}; }`], 31 isActive: true, 32 }, 33 { 34 info: `${propertyName} is inactive on a non-grid container`, 35 property: propertyName, 36 tagName: "div", 37 rules: [`div { ${propertyName}: ${propertyValue}; }`], 38 isActive: false, 39 }, 40 ]; 41 } 42 43 export default tests;