| Index: third_party/WebKit/LayoutTests/svg/dom/href-semantics.html
|
| diff --git a/third_party/WebKit/LayoutTests/svg/dom/href-semantics.html b/third_party/WebKit/LayoutTests/svg/dom/href-semantics.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4d4298232ec8d54620d803430b0b7f4211f5fbcc
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/svg/dom/href-semantics.html
|
| @@ -0,0 +1,137 @@
|
| +<!DOCTYPE html>
|
| +<title>SVGURIReference.href IDL semantics</title>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +const svgNs = 'http://www.w3.org/2000/svg';
|
| +const xlinkNs = 'http://www.w3.org/1999/xlink';
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(null, 'href', 'foo');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" exists');
|
| + assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" does not exist');
|
| + assert_equals(element.href.baseVal, 'foo');
|
| +
|
| + element.href.baseVal = 'bar';
|
| + assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" still does not exist');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" still exists');
|
| + assert_equals(element.getAttributeNS(null, 'href'), 'bar');
|
| +}, document.title+', IDL href backed by "href" after setAttribute(href).');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(xlinkNs, 'href', 'foo');
|
| + assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_equals(element.href.baseVal, 'foo');
|
| +
|
| + element.href.baseVal = 'bar';
|
| + assert_false(element.hasAttributeNS(null, 'href'), '"href" still does not exist');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" still exists');
|
| + assert_equals(element.getAttributeNS(xlinkNs, 'href'), 'bar');
|
| +}, document.title+', IDL href backed by "xlink:href" after setAttribute(xlink:href).');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.href.baseVal = 'foo';
|
| + assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" does not exist');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" exists');
|
| + assert_equals(element.href.baseVal, 'foo');
|
| +}, document.title+', IDL href backed by "href" after baseVal setter.');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.href.baseVal = 'foo';
|
| + assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" does not exist');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" exists');
|
| + assert_equals(element.href.baseVal, 'foo');
|
| +
|
| + element.setAttributeNS(xlinkNs, 'href', 'bar');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" still exists');
|
| + assert_equals(element.href.baseVal, 'foo', 'baseVal still reflects "href"');
|
| + assert_equals(element.getAttributeNS(xlinkNs, 'href'), 'bar');
|
| +}, document.title+', IDL href reflects "href"; setAttribute(xlink:href) does not override baseVal setter.');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(xlinkNs, 'href', 'baz');
|
| + element.href.baseVal = 'foo';
|
| + assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_equals(element.href.baseVal, 'foo');
|
| + assert_equals(element.getAttributeNS(xlinkNs, 'href'), 'foo');
|
| +
|
| + element.setAttributeNS(null, 'href', 'bar');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" still exists');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" exists');
|
| + assert_equals(element.href.baseVal, 'bar', 'baseVal prefers "href" to "xlink:href"');
|
| + assert_equals(element.getAttributeNS(xlinkNs, 'href'), 'foo');
|
| + assert_equals(element.getAttributeNS(null, 'href'), 'bar');
|
| +}, document.title+', IDL href prefers "href" over "xlink:href" after setAttribute(href) overrides.');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(xlinkNs, 'href', 'foo');
|
| + assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_equals(element.href.baseVal, 'foo');
|
| + assert_equals(element.getAttributeNS(xlinkNs, 'href'), 'foo');
|
| +
|
| + element.setAttributeNS(xlinkNs, 'xlink:href', 'bar');
|
| + assert_equals(element.href.baseVal, 'bar');
|
| +}, document.title+', IDL href reflects "xlink:href"; setAttribute(xlink:href) w/ NS-prefix.');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(null, 'href', 'foo');
|
| + element.setAttributeNS(xlinkNs, 'href', 'bar');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" exists');
|
| + assert_equals(element.href.baseVal, 'foo', 'baseVal reflects "href"');
|
| +
|
| + element.removeAttributeNS(null, 'href');
|
| + assert_false(element.hasAttributeNS(null, 'href'), '"href" no longer exist');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" still exist');
|
| + assert_equals(element.href.baseVal, 'bar', 'baseVal reflects "xlink:href"');
|
| +}, document.title+', IDL href reflects "xlink:href" after removeAttribute(href).');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(null, 'href', 'foo');
|
| + element.setAttributeNS(xlinkNs, 'href', 'bar');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" exists');
|
| + assert_equals(element.href.baseVal, 'foo', 'baseVal reflects "href"');
|
| +
|
| + element.removeAttributeNS(xlinkNs, 'href');
|
| + assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" no longer exist');
|
| + assert_true(element.hasAttributeNS(null, 'href'), '"href" still exist');
|
| + assert_equals(element.href.baseVal, 'foo', 'baseVal reflects "href"');
|
| +}, document.title+', IDL href reflects "xlink:href"; removeAttribute(xlink:href) has no effect.');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(xlinkNs, 'href', 'bar');
|
| + assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_equals(element.href.baseVal, 'bar', 'baseVal reflects "xlink:href"');
|
| +
|
| + element.removeAttributeNS(xlinkNs, 'href');
|
| + assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" no longer exist');
|
| + assert_equals(element.href.baseVal, '');
|
| +}, document.title+', IDL href reflects "xlink:href"; removeAttribute(xlink:href) resets to default.');
|
| +
|
| +test(function() {
|
| + var element = document.createElementNS(svgNs, 'a');
|
| + element.setAttributeNS(xlinkNs, 'xlink:href', 'bar');
|
| + assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist');
|
| + assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists');
|
| + assert_equals(element.href.baseVal, 'bar', 'baseVal reflects "xlink:href"');
|
| +
|
| + element.removeAttributeNS(xlinkNs, 'href');
|
| + assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" no longer exist');
|
| + assert_equals(element.href.baseVal, '');
|
| +}, document.title+', IDL href reflects "xlink:href"; removeAttribute(xlink:href) w/o NS-prefix resets to default.');
|
| +</script>
|
|
|