aspect-ratio.js (498B)
1 function test_computed_style_aspect_ratio(tag, attributes, expected) { 2 test(function() { 3 var elem = document.createElement(tag); 4 for (name in attributes) { 5 let val = attributes[name]; 6 if (val !== null) 7 elem.setAttribute(name, val); 8 } 9 document.body.appendChild(elem); 10 let aspectRatio = getComputedStyle(elem).aspectRatio; 11 assert_equals(aspectRatio, expected); 12 elem.remove(); 13 }, `Computed style test: ${tag} with ${JSON.stringify(attributes)}`); 14 }