content-visibility.mjs (1741B)
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: `content-visibility` test cases. 6 const tests = [ 7 ...createDisplayTests( 8 [ 9 "block", 10 "block ruby", 11 "flex", 12 "flow-root", 13 "flow-root list-item", 14 "grid", 15 "inherit", 16 "inline flow-root list-item", 17 "inline-block", 18 "inline-flex", 19 "inline-grid", 20 "list-item", 21 "table-caption", 22 ], 23 true 24 ), 25 ...createDisplayTests( 26 [ 27 "none", 28 "contents", 29 "initial", 30 "inline", 31 "inline list-item", 32 "inline-table", 33 "ruby", 34 "ruby-base", 35 "ruby-base-container", 36 "ruby-text", 37 "ruby-text-container", 38 "table", 39 "table-cell", 40 "table-column", 41 "table-column-group", 42 "table-footer-group", 43 "table-header-group", 44 "table-row", 45 "table-row-group", 46 "unset", 47 ], 48 false 49 ), 50 { 51 info: "content-visibility is active on replaced element", 52 property: "content-visibility", 53 tagName: "img", 54 rules: ["img { content-visibility: hidden; display: block; }"], 55 isActive: true, 56 }, 57 ]; 58 59 function createDisplayTests(displayValues, active) { 60 return displayValues.map(displayValue => { 61 return { 62 info: `content-visibility is ${ 63 active ? "active" : "inactive" 64 } on an element with display: ${displayValue}`, 65 property: "content-visibility", 66 tagName: "div", 67 rules: [`div { display: ${displayValue}; content-visibility: auto; }`], 68 isActive: active, 69 }; 70 }); 71 } 72 73 export default tests;