Status: FAIL | Duration: 55ms | Subtests: 0/1 | Open test on wpt.live | wpt.fyi
/svg/types/scripted/SVGLength-cap.html
<!DOCTYPE HTML> <title>SVGLength with 'cap' unit</title> <link rel="help" href="https://www.w3.org/TR/SVG/types.html#InterfaceSVGLength"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <div id="cap_ref" style="font-family:initial; font-size:20px; width:10cap"></div> <svg> <text id="cap_test" x="10cap" style="font-family:initial; font-size:20px"></text> </svg> <script> let ref_width = cap_ref.getBoundingClientRect().width; let cap_length = cap_test.x.baseVal[0]; test(() => { assert_equals(cap_length.unitType, SVGLength.SVG_LENGTHTYPE_UNKNOWN); assert_approx_equals(cap_length.value, ref_width, 0.1); }, "cap unit in SVGLength"); test(() => { cap_length.value = ref_width * 2; assert_approx_equals(cap_length.valueInSpecifiedUnits, 20, 0.1); }, "Convert back to cap from new user unit value"); </script>