wpt / css / css-text / parsing / white-space-shorthand.html

Status: PASS | Duration: 116ms | Subtests: 45/45 | 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
e.style['white-space'] = "collapse" should set the property valuePASS
Property white-space value 'collapse'PASS
e.style['white-space'] = "wrap" should set the property valuePASS
Property white-space value 'wrap'PASS
e.style['white-space'] = "collapse wrap" should set the property valuePASS
Property white-space value 'collapse wrap'PASS
e.style['white-space'] = "wrap collapse" should set the property valuePASS
Property white-space value 'wrap collapse'PASS
e.style['white-space'] = "preserve nowrap" should set the property valuePASS
Property white-space value 'preserve nowrap'PASS
e.style['white-space'] = "nowrap preserve" should set the property valuePASS
Property white-space value 'nowrap preserve'PASS
e.style['white-space'] = "nowrap" should set the property valuePASS
Property white-space value 'nowrap'PASS
e.style['white-space'] = "collapse nowrap" should set the property valuePASS
Property white-space value 'collapse nowrap'PASS
e.style['white-space'] = "nowrap collapse" should set the property valuePASS
Property white-space value 'nowrap collapse'PASS
e.style['white-space'] = "preserve" should set the property valuePASS
Property white-space value 'preserve'PASS
e.style['white-space'] = "preserve wrap" should set the property valuePASS
Property white-space value 'preserve wrap'PASS
e.style['white-space'] = "wrap preserve" should set the property valuePASS
Property white-space value 'wrap preserve'PASS
e.style['white-space'] = "break-spaces" should set the property valuePASS
Property white-space value 'break-spaces'PASS
e.style['white-space'] = "break-spaces wrap" should set the property valuePASS
Property white-space value 'break-spaces wrap'PASS
e.style['white-space'] = "wrap break-spaces" should set the property valuePASS
Property white-space value 'wrap break-spaces'PASS
e.style['white-space'] = "preserve-breaks" should set the property valuePASS
Property white-space value 'preserve-breaks'PASS
e.style['white-space'] = "preserve-breaks wrap" should set the property valuePASS
Property white-space value 'preserve-breaks wrap'PASS
e.style['white-space'] = "wrap preserve-breaks" should set the property valuePASS
Property white-space value 'wrap preserve-breaks'PASS
e.style['white-space'] = "preserve-breaks nowrap" should set the property valuePASS
Property white-space value 'preserve-breaks nowrap'PASS
e.style['white-space'] = "nowrap preserve-breaks" should set the property valuePASS
Property white-space value 'nowrap preserve-breaks'PASS
e.style['white-space'] = "balance" should not set the property valuePASS
e.style['white-space'] = "collapse balance" should not set the property valuePASS
e.style['white-space'] = "balance collapse" should not set the property valuePASS
e.style['white-space'] = "preserve balance" should not set the property valuePASS
e.style['white-space'] = "balance preserve" should not set the property valuePASS

/css/css-text/parsing/white-space-shorthand.html

<!DOCTYPE html>
<title>CSS Text Module Test: parsing white-space as a shorthand</title>
<link rel="help" href="https://drafts.csswg.org/css-text-4/#propdef-white-space">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<div id="target"></div>
<script>
function test_valid_and_computed_value(property, specified, serialized) {
  test_valid_value(property, specified, serialized);
  test_computed_value(property, specified, serialized);
}

test_valid_and_computed_value("white-space", "collapse", "normal");
test_valid_and_computed_value("white-space", "wrap", "normal");
test_valid_and_computed_value("white-space", "collapse wrap", "normal");
test_valid_and_computed_value("white-space", "wrap collapse", "normal");

test_valid_and_computed_value("white-space", "preserve nowrap", "pre");
test_valid_and_computed_value("white-space", "nowrap preserve", "pre");

test_valid_and_computed_value("white-space", "nowrap", "nowrap");
test_valid_and_computed_value("white-space", "collapse nowrap", "nowrap");
test_valid_and_computed_value("white-space", "nowrap collapse", "nowrap");

test_valid_and_computed_value("white-space", "preserve", "pre-wrap");
test_valid_and_computed_value("white-space", "preserve wrap", "pre-wrap");
test_valid_and_computed_value("white-space", "wrap preserve", "pre-wrap");

test_valid_and_computed_value("white-space", "break-spaces", "break-spaces");
test_valid_and_computed_value("white-space", "break-spaces wrap", "break-spaces");
test_valid_and_computed_value("white-space", "wrap break-spaces", "break-spaces");

test_valid_and_computed_value("white-space", "preserve-breaks", "pre-line");
test_valid_and_computed_value("white-space", "preserve-breaks wrap", "pre-line");
test_valid_and_computed_value("white-space", "wrap preserve-breaks", "pre-line");

// Combinations of existing values that are not pre-defined.
test_valid_and_computed_value("white-space", "preserve-breaks nowrap", "preserve-breaks nowrap");
test_valid_and_computed_value("white-space", "nowrap preserve-breaks", "preserve-breaks nowrap");

// Values not available through the shorthand.
test_invalid_value("white-space", "balance");
test_invalid_value("white-space", "collapse balance");
test_invalid_value("white-space", "balance collapse");
test_invalid_value("white-space", "preserve balance");
test_invalid_value("white-space", "balance preserve");
</script>