Status: FAIL | Duration: 57ms | Subtests: 2/11 | Open test on wpt.live | wpt.fyi
Data from commit:
a50cb89 wpt: run reference-named files which are themselves tests (#836) (2026-09-03)
| Subtest | Status | Message |
|---|---|---|
| Converting a CSSNumericValue to a sum with invalid units throws SyntaxError | FAIL | assert_throws_dom: function "() => CSS.px(1).toSum('px', 'lemon')" threw object "TypeError: not a callable function" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12 |
| Converting a CSSNumericValue with an invalid sum value to a sum throws TypeError | FAIL | assert_throws_js: function "() => new CSSMathMax(1, CSS.px(1)).toSum('number')" threw object "ReferenceError: CSSMathMax is not defined" ("ReferenceError") expected instance of function "function TypeError() { [native code] }" ("TypeError") |
| Converting a CSSNumericValue with compound units to a sum throws TypeError | FAIL | assert_throws_js: function "() => new CSSMathProduct(CSS.px(1), CSS.px(1)).to('px')" threw object "ReferenceError: CSSMathProduct is not defined" ("ReferenceError") expected instance of function "function TypeError() { [native code] }" ("TypeError") |
| Converting a CSSNumericValue to a sum with an incompatible unit throws TypeError | PASS | |
| Converting a CSSNumericValue to a sum with units that are not addable throws TypeError | PASS | |
| Converting a CSSNumericValue with leftover units to a sum throws TypeError | FAIL | assert_throws_js: function "() => new CSSMathSum(CSS.px(1), CSS.em(1)).toSum('px')" threw object "ReferenceError: CSSMathSum is not defined" ("ReferenceError") expected instance of function "function TypeError() { [native code] }" ("TypeError") |
| Converting CSSNumericValue to a sum with its own unit returns itself | FAIL | not a callable function |
| Converting CSSNumericValue to a sum with no arguments returns all the units in sorted order | FAIL | CSSMathSum is not defined |
| Converting CSSNumericValue to a sum with a relative unit converts correctly | FAIL | not a callable function |
| Converting CSSNumericValue to a sum containing extra units returns zero for those units | FAIL | not a callable function |
| CSSNumericValue.toSum converts greedily | FAIL | CSSMathSum is not defined |
/css/css-typed-om/stylevalue-subclasses/numeric-objects/toSum.tentative.html
<meta charset="utf-8"> <title>CSSNumericValue.toSum tests</title> <link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssnumericvalue-tosum"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="../../resources/testhelper.js"></script> <script> 'use strict'; test(() => { assert_throws_dom("SyntaxError", () => CSS.px(1).toSum('px', 'lemon')); }, 'Converting a CSSNumericValue to a sum with invalid units throws SyntaxError'); test(() => { assert_throws_js(TypeError, () => new CSSMathMax(1, CSS.px(1)).toSum('number')); }, 'Converting a CSSNumericValue with an invalid sum value to a sum throws TypeError'); test(() => { assert_throws_js(TypeError, () => new CSSMathProduct(CSS.px(1), CSS.px(1)).to('px')); }, 'Converting a CSSNumericValue with compound units to a sum throws TypeError'); test(() => { assert_throws_js(TypeError, () => CSS.px(1).toSum('number')); }, 'Converting a CSSNumericValue to a sum with an incompatible unit throws TypeError'); test(() => { assert_throws_js(TypeError, () => CSS.px(1).toSum('px', 's')); }, 'Converting a CSSNumericValue to a sum with units that are not addable throws TypeError'); test(() => { assert_throws_js(TypeError, () => new CSSMathSum(CSS.px(1), CSS.em(1)).toSum('px')); }, 'Converting a CSSNumericValue with leftover units to a sum throws TypeError'); test(() => { assert_style_value_equals(CSS.number(1).toSum('number'), new CSSMathSum(CSS.number(1))); assert_style_value_equals(CSS.px(1).toSum('px'), new CSSMathSum(CSS.px(1))); }, 'Converting CSSNumericValue to a sum with its own unit returns itself'); test(() => { assert_style_value_equals( new CSSMathSum(CSS.px(1), CSS.em(1), CSS.vw(1), CSS.rem(1)).toSum(), new CSSMathSum(CSS.em(1), CSS.px(1), CSS.rem(1), CSS.vw(1)) ); }, 'Converting CSSNumericValue to a sum with no arguments returns all the units in sorted order'); // TODO(776173): cssUnitValue_toMethod.html has more comprehensive tests of converting // within the same base type. Merge those tests into here. test(() => { assert_style_value_equals(CSS.cm(2).toSum('mm'), new CSSMathSum(CSS.mm(20))); }, 'Converting CSSNumericValue to a sum with a relative unit converts correctly'); test(() => { assert_style_value_equals( CSS.px(1).toSum('em', 'px', 'vw'), new CSSMathSum(CSS.em(0), CSS.px(1), CSS.vw(0)) ); }, 'Converting CSSNumericValue to a sum containing extra units returns zero for those units'); test(() => { assert_style_value_equals( new CSSMathSum(CSS.cm(1), CSS.mm(10)).toSum('cm', 'mm'), new CSSMathSum(CSS.cm(2), CSS.mm(0)) ); assert_style_value_equals( new CSSMathSum(CSS.cm(1), CSS.mm(10)).toSum('mm', 'cm'), new CSSMathSum(CSS.mm(20), CSS.cm(0)) ); }, 'CSSNumericValue.toSum converts greedily'); </script>