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

Unified Diff: tests/html/node_test.dart

Issue 13852008: Removing redundant collection methods from DOM collections. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « tests/html/element_test.dart ('k') | tools/dom/src/WrappedList.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/node_test.dart
diff --git a/tests/html/node_test.dart b/tests/html/node_test.dart
index b2c83997436eb8692beb616fcb225ae23553f0bd..ad4911e250bf742aa6323cfe27db485c2a382b25 100644
--- a/tests/html/node_test.dart
+++ b/tests/html/node_test.dart
@@ -12,6 +12,12 @@ Node makeNode() => new Element.tag('div');
Node makeNodeWithChildren() =>
new Element.html("<div>Foo<br/><!--baz--></div>");
+void testUnsupported(String name, void f()) {
+ test(name, () {
+ expect(f, throwsUnsupportedError);
+ });
+}
+
main() {
useHtmlIndividualConfiguration();
@@ -256,10 +262,66 @@ main() {
expect(node.nodes.length, 1);
});
+ test('getRange', () {
+ var items = makeNodeWithChildren().nodes.getRange(0, 1);
+ expect(items.length, 1);
+ expect(items.first, isText);
+ });
+
test('sublist', () {
var node = makeNodeWithChildren();
expect(node.nodes.sublist(1, 3), isNodeList);
});
+
+ test('insertAll', () {
+ var node = makeNodeWithChildren();
+ var b = new DivElement();
+ b.nodes.addAll([
+ new HRElement(),
+ new ImageElement(),
+ new InputElement()
+ ]);
+ node.nodes.insertAll(1, b.nodes);
+ expect(node.nodes[0], isText);
+ expect(node.nodes[1], isHRElement);
+ expect(node.nodes[2], isImageElement);
+ expect(node.nodes[3], isInputElement);
+ expect(node.nodes[4], isBRElement);
+ expect(node.nodes[5], isComment);
+
+ var nodes = [
+ new HRElement(),
+ new ImageElement(),
+ new InputElement()
+ ];
+ node.nodes.insertAll(5, nodes);
+
+ expect(node.nodes[0], isText);
+ expect(node.nodes[1], isHRElement);
+ expect(node.nodes[2], isImageElement);
+ expect(node.nodes[3], isInputElement);
+ expect(node.nodes[4], isBRElement);
+ expect(node.nodes[5], isHRElement);
+ expect(node.nodes[6], isImageElement);
+ expect(node.nodes[7], isInputElement);
+ expect(node.nodes[8], isComment);
+ });
+
+ testUnsupported('removeRange', () {
+ makeNodeWithChildren().nodes.removeRange(0, 1);
+ });
+
+ testUnsupported('replaceRange', () {
+ makeNodeWithChildren().nodes.replaceRange(0, 1, [new InputElement()]);
+ });
+
+ testUnsupported('fillRange', () {
+ makeNodeWithChildren().nodes.fillRange(0, 1, null);
+ });
+
+ testUnsupported('setAll', () {
+ makeNodeWithChildren().nodes.setAll(0, [new InputElement()]);
+ });
});
group('_NodeList', () {
« no previous file with comments | « tests/html/element_test.dart ('k') | tools/dom/src/WrappedList.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698