wpt / css / css-typed-om / stylevalue-subclasses / numeric-objects / cssUnitValue.html

Status: FAIL | Duration: 66ms | Subtests: 0/36 | Open test on wpt.live | wpt.fyi

Data from commit:
a50cb89 wpt: run reference-named files which are themselves tests (#836) (2026-09-03)

SubtestStatusMessage
Constructing CSSUnitValue with an unknown unit throws a TypeErrorFAILassert_throws_js: function "() => new CSSUnitValue(0, 'lemon')" threw object "ReferenceError: CSSUnitValue is not defined" ("ReferenceError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
Constructing CSSUnitValue with a empty string unit throws a TypeErrorFAILassert_throws_js: function "() => new CSSUnitValue(0, '')" threw object "ReferenceError: CSSUnitValue is not defined" ("ReferenceError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
CSSUnitValue can be constructed with numberFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with percentFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with emFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with exFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with chFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with icFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with remFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with lhFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with rlhFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with vwFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with vhFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with viFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with vbFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with vminFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with vmaxFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with cmFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with mmFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with QFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with inFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with ptFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with pcFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with pxFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with degFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with gradFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with radFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with turnFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with sFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with msFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with HzFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with kHzFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with dpiFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with dpcmFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with dppxFAILCSSUnitValue is not defined
CSSUnitValue can be constructed with frFAILCSSUnitValue is not defined

/css/css-typed-om/stylevalue-subclasses/numeric-objects/cssUnitValue.html

<!doctype html>
<meta charset="utf-8">
<title>CSSUnitValue Constructor</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunitvalue-cssunitvalue">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';

test(() => {
  assert_throws_js(TypeError, () => new CSSUnitValue(0, 'lemon'));
}, 'Constructing CSSUnitValue with an unknown unit throws a TypeError');

test(() => {
  assert_throws_js(TypeError, () => new CSSUnitValue(0, ''));
}, 'Constructing CSSUnitValue with a empty string unit throws a TypeError');

for (const unit of gValidUnits) {
  test(() => {
    const result = new CSSUnitValue(-3.14, unit);
    assert_not_equals(result, null, 'a CSSUnitValue is created');
    assert_equals(result.value, -3.14,
                  'value is same as given by constructor');
    assert_equals(result.unit, unit.toLowerCase(),
                  'unit is same as given by constructor');
  }, 'CSSUnitValue can be constructed with ' + unit);
}

</script>