Index: tests/html/element_test.dart |
diff --git a/tests/html/element_test.dart b/tests/html/element_test.dart |
index a3e6acd119b94c2b74c172fdcc6a9646acbd0ad0..c9b8612bf2d49d90ca16fe18bd4e4a7f57b84444 100644 |
--- a/tests/html/element_test.dart |
+++ b/tests/html/element_test.dart |
@@ -149,7 +149,7 @@ main() { |
'<thead><tr><td>foo</td></tr></thead>', 'foo', |
(element) => element is TableSectionElement)); |
}); |
- |
+ |
group('constructors', () { |
test('error', () { |
expect(() => new Element.html('<br/><br/>'), throwsArgumentError); |
@@ -283,7 +283,7 @@ main() { |
// '<someunknown>foo</someunknown>', 'foo', |
// (element) => element is UnknownElement)); |
}); |
- |
+ |
group('eventListening', () { |
test('eventListeners', () { |
final element = new Element.tag('div'); |
@@ -464,6 +464,34 @@ main() { |
attributes['style'] = 'width: 300px;'; |
expect(attributes.length, 5); |
}); |
+ |
+ test('namespaces', () { |
+ var element = new 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('elements', () { |