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

Unified Diff: tests/html/element_test.dart

Issue 16171012: Correctly implemented removeWhere and retainWhere for elements in dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months 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/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | 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 aae4dda3510372eff6f875eaa75b4cabc00a6499..353733501166435b43a97792b189c1d0a43994aa 100644
--- a/tests/html/element_test.dart
+++ b/tests/html/element_test.dart
@@ -500,6 +500,50 @@ main() {
expect(el.children.getRange(1, 2).length, 1);
});
+ test('retainWhere', () {
+ var el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.retainWhere((e) => true);
+ expect(el.children.length, 3);
+
+ el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.retainWhere((e) => false);
+ expect(el.children.length, 0);
+
+ el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.retainWhere((e) => e.localName == 'input');
+ expect(el.children.length, 1);
+
+ el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.retainWhere((e) => e.localName == 'br');
+ expect(el.children.length, 1);
+ });
+
+ test('removeWhere', () {
+ var el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.removeWhere((e) => true);
+ expect(el.children.length, 0);
+
+ el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.removeWhere((e) => false);
+ expect(el.children.length, 3);
+
+ el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.removeWhere((e) => e.localName == 'input');
+ expect(el.children.length, 2);
+
+ el = makeElementWithChildren();
+ expect(el.children.length, 3);
+ el.children.removeWhere((e) => e.localName == 'br');
+ expect(el.children.length, 2);
+ });
+
testUnsupported('sort', () {
var l = makeElementWithChildren().children;
l.sort();
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/templates/html/impl/impl_Element.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698