summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js
blob: c6826f271a5ca9814c13a46675d6483c816ba6a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function test_computed_style_aspect_ratio(tag, attributes, expected) {
  test(function() {
    var elem = document.createElement(tag);
    for (name in attributes) {
      let val = attributes[name];
      if (val !== null)
        elem.setAttribute(name, val);
    }
    document.body.appendChild(elem);
    let aspectRatio = getComputedStyle(elem).aspectRatio;
    assert_equals(aspectRatio, expected);
    elem.remove();
  }, `Computed style test: ${tag} with ${JSON.stringify(attributes)}`);
}