Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2144)

Unified Diff: tests/html/element_test.dart

Issue 11348111: Adding support for accessing attributes in alternate namespaces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporating review feedback. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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', () {
« no previous file with comments | « sdk/lib/html/templates/html/impl/impl_Element.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698