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

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: Minor cleanup 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
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', () {

Powered by Google App Engine
This is Rietveld 408576698