wpt / svg / types / scripted / SVGAnimatedEnumeration-SVGTextPathElement.html

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

Data from commit:
96ff533 Remove hidden nodes from the acccessibility tree (#823) (2026-09-07)

SubtestStatusMessage
Use of SVGAnimatedEnumeration within SVGTextPathElementFAILSVGAnimatedEnumeration is not defined
Use of SVGAnimatedEnumeration within SVGTextPathElement 1FAILSVGAnimatedEnumeration is not defined
Use of SVGAnimatedEnumeration within SVGTextPathElement 2FAILSVGAnimatedEnumeration is not defined

/svg/types/scripted/SVGAnimatedEnumeration-SVGTextPathElement.html

<!DOCTYPE HTML>
<title>Use of SVGAnimatedEnumeration within SVGTextPathElement</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
  // This test checks the use of SVGAnimatedEnumeration within SVGTextPathElement.

  let textPathElement = document.createElementNS("http://www.w3.org/2000/svg", "textPath");
  textPathElement.setAttribute("method", "align");

  // method
  // Check initial 'method' value.
  assert_true(textPathElement.method instanceof SVGAnimatedEnumeration);
  assert_equals(typeof(textPathElement.method.baseVal), "number");
  assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN);

  // Switch to 'stretch'.
  textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH;
  assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH);
  assert_equals(textPathElement.getAttribute('method'), "stretch");

  // Try setting invalid values.
  assert_throws_js(TypeError, function() { textPathElement.method.baseVal = 3; });
  assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH);
  assert_equals(textPathElement.getAttribute('method'), "stretch");

  assert_throws_js(TypeError, function() { textPathElement.method.baseVal = -1; });
  assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH);
  assert_equals(textPathElement.getAttribute('method'), "stretch");

  assert_throws_js(TypeError, function() { textPathElement.method.baseVal = 0; });
  assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_STRETCH);
  assert_equals(textPathElement.getAttribute('method'), "stretch");

  // Switch to 'align'.
  textPathElement.method.baseVal = SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN;
  assert_equals(textPathElement.method.baseVal, SVGTextPathElement.TEXTPATH_METHODTYPE_ALIGN);
  assert_equals(textPathElement.getAttribute('method'), "align");
});

test(function() {
  let textPathElement = document.createElementNS("http://www.w3.org/2000/svg", "textPath");
  textPathElement.setAttribute("spacing", "auto");

  // spacing
  // Check initial 'spacing' value.
  assert_true(textPathElement.spacing instanceof SVGAnimatedEnumeration);
  assert_equals(typeof(textPathElement.spacing.baseVal), "number");
  assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO);

  // Switch to 'exact'.
  textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT;
  assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT);
  assert_equals(textPathElement.getAttribute('spacing'), "exact");

  // Try setting invalid values.
  assert_throws_js(TypeError, function() { textPathElement.spacing.baseVal = 3; });
  assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT);
  assert_equals(textPathElement.getAttribute('spacing'), "exact");

  assert_throws_js(TypeError, function() { textPathElement.spacing.baseVal = -1; });
  assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT);
  assert_equals(textPathElement.getAttribute('spacing'), "exact");

  assert_throws_js(TypeError, function() { textPathElement.spacing.baseVal = 0; });
  assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_EXACT);
  assert_equals(textPathElement.getAttribute('spacing'), "exact");

  // Switch to 'auto'.
  textPathElement.spacing.baseVal = SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO;
  assert_equals(textPathElement.spacing.baseVal, SVGTextPathElement.TEXTPATH_SPACINGTYPE_AUTO);
  assert_equals(textPathElement.getAttribute('spacing'), "auto");
});

test(function() {
  let textPathElement = document.createElementNS("http://www.w3.org/2000/svg", "textPath");
  textPathElement.setAttribute("side", "left");

  // side
  // Check initial 'side' value.
  assert_true(textPathElement.side instanceof SVGAnimatedEnumeration);
  assert_equals(typeof(textPathElement.side.baseVal), "number");
  assert_equals(textPathElement.side.baseVal, SVGTextPathElement.TEXTPATH_SIDETYPE_LEFT);

  // Switch to 'right'.
  textPathElement.side.baseVal = SVGTextPathElement.TEXTPATH_SIDETYPE_RIGHT;
  assert_equals(textPathElement.side.baseVal, SVGTextPathElement.TEXTPATH_SIDETYPE_RIGHT);
  assert_equals(textPathElement.getAttribute('side'), "right");

  // Try setting invalid values.
  assert_throws_js(TypeError, function() { textPathElement.side.baseVal = 3; });
  assert_equals(textPathElement.side.baseVal, SVGTextPathElement.TEXTPATH_SIDETYPE_RIGHT);
  assert_equals(textPathElement.getAttribute('side'), "right");

  assert_throws_js(TypeError, function() { textPathElement.side.baseVal = -1; });
  assert_equals(textPathElement.side.baseVal, SVGTextPathElement.TEXTPATH_SIDETYPE_RIGHT);
  assert_equals(textPathElement.getAttribute('side'), "right");

  assert_throws_js(TypeError, function() { textPathElement.side.baseVal = 0; });
  assert_equals(textPathElement.side.baseVal, SVGTextPathElement.TEXTPATH_SIDETYPE_RIGHT);
  assert_equals(textPathElement.getAttribute('side'), "right");

  // Switch to 'left'.
  textPathElement.side.baseVal = SVGTextPathElement.TEXTPATH_SIDETYPE_LEFT;
  assert_equals(textPathElement.side.baseVal, SVGTextPathElement.TEXTPATH_SIDETYPE_LEFT);
  assert_equals(textPathElement.getAttribute('side'), "left");
});
</script>