Index: tests/html/element_test.dart |
diff --git a/tests/html/element_test.dart b/tests/html/element_test.dart |
index 2a5d46079a48e806c125af5f4a6238ee2c0ba4b3..6825c91175a7de3e6912c735620847377f074f69 100644 |
--- a/tests/html/element_test.dart |
+++ b/tests/html/element_test.dart |
@@ -464,6 +464,34 @@ main() { |
attributes['style'] = 'width: 300px;'; |
expect(attributes.length, 5); |
}); |
+ |
+ test('namespaces', () { |
+ var element = new svg.SvgElement.svg( |
+ '''<svg xmlns="http://www.w3.org/2000/svg" |
+ xmlns:xlink="http://www.w3.org/1999/xlink"> |
+ <image xlink:href="foo" data-foo="bar"/> |
+ </svg>''').elements[0]; |
+ |
+ var attributes = element.attributes; |
+ expect(attributes.length, 1); |
+ expect(attributes['data-foo'], 'bar'); |
+ |
+ var xlinkAttrs = |
+ element.getNamespacedAttributes('http://www.w3.org/1999/xlink'); |
+ expect(xlinkAttrs.length, 1); |
+ expect(xlinkAttrs['href'], 'foo'); |
+ |
+ xlinkAttrs.remove('href'); |
+ expect(xlinkAttrs.length, 0); |
+ |
+ xlinkAttrs['href'] = 'bar'; |
+ expect(xlinkAttrs['href'], 'bar'); |
+ |
+ var randomAttrs = element.getNamespacedAttributes('http://example.com'); |
+ expect(randomAttrs.length, 0); |
+ randomAttrs['href'] = 'bar'; |
+ expect(randomAttrs.length, 1); |
+ }); |
}); |
group('children', () { |