wpt / css / css-backgrounds / parsing / background-shorthand-serialization.html

Status: FAIL | Duration: 54ms | Subtests: 0/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)

SubtestStatusMessage
single valueFAILassert_equals: expected "yellow" but got ""
multiple valuesFAILassert_equals: expected "url(\"/favicon.ico\") no-repeat" but got ""
multiple backgroundsFAILassert_equals: expected "url(\"/favicon.ico\") no-repeat, url(\"/favicon.ico\") no-repeat" but got ""
background-size with non-initial background-positionFAILassert_equals: expected "url(\"/favicon.ico\") 0% 0% / 10rem auto" but got ""
multiple backgrounds with varying valuesFAILassert_equals: expected "url(\"/favicon.ico\") left top no-repeat, url(\"/favicon.ico\") center center / 100% 100% no-repeat, url(\"/favicon.ico\") white" but got ""
all initial valuesFAILassert_equals: expected "none" but got ""
border-area border-boxFAILassert_equals: expected "border-area" but got ""
border-area padding-boxFAILassert_equals: expected "padding-box border-area" but got ""
border-area text sets background-clipFAILassert_equals: expected "border-area text" but got ""
text border-area serializes as border-area textFAILassert_equals: expected "border-area text" but got ""
border-area text sets background-origin to border-boxFAILassert_equals: expected "border-box" but got ""

/css/css-backgrounds/parsing/background-shorthand-serialization.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Background Shorthand Specified Value Serialization Test: background shorthand should only serialize non-initial values</title>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#background">
<meta name="assert" content="background shorthand should only serialize non-initial values">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
  const element = document.createElement('div');

  test((t) => {
    element.style = 'background: yellow;';
    assert_equals(element.style.background , 'yellow');
  }, "single value");

  test((t) => {
    element.style = 'background: no-repeat url(/favicon.ico);';
    assert_equals(element.style.background , 'url("/favicon.ico") no-repeat');
  }, "multiple values");

  test((t) => {
    element.style = 'background: url(/favicon.ico) no-repeat, url(/favicon.ico) no-repeat;';
    assert_equals(element.style.background , 'url("/favicon.ico") no-repeat, url("/favicon.ico") no-repeat');
  }, "multiple backgrounds");

  test((t) => {
    element.style = 'background: url("/favicon.ico") 0% 0% / 10rem;';
    // background-size should always serialize to two values per https://github.com/w3c/csswg-drafts/issues/7802
    assert_equals(element.style.background , 'url("/favicon.ico") 0% 0% / 10rem auto');
  }, "background-size with non-initial background-position");

  test((t) => {
    element.style = `background: url(/favicon.ico) top left no-repeat,
        url(/favicon.ico) center / 100% 100% no-repeat,
        url(/favicon.ico) white;`;
    assert_equals(element.style.background , 'url("/favicon.ico") left top no-repeat, url("/favicon.ico") center center / 100% 100% no-repeat, url("/favicon.ico") white');
  }, "multiple backgrounds with varying values");

  test((t) => {
    element.style = `background: padding-box border-box;`;
    assert_equals(element.style.background , 'none');
  }, "all initial values");


  test((t) => {
    element.style = `background: border-area border-box;`;
    assert_equals(element.style.background , 'border-area');
  }, "border-area border-box");


  test((t) => {
    element.style = `background: border-area padding-box;`;
    assert_equals(element.style.background , 'padding-box border-area');
  }, "border-area padding-box");

  test((t) => {
    element.style = `background: border-area text;`;
    assert_equals(element.style.backgroundClip , 'border-area text');
  }, "border-area text sets background-clip");

  test((t) => {
    element.style = `background: text border-area;`;
    assert_equals(element.style.backgroundClip , 'border-area text');
  }, "text border-area serializes as border-area text");

  test((t) => {
    element.style = `background: border-area text;`;
    assert_equals(element.style.backgroundOrigin , 'border-box');
  }, "border-area text sets background-origin to border-box");
</script>