24 lines
668 B
Dart
24 lines
668 B
Dart
import 'dart:sky';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
test("getChildElements should only include immediate children", () {
|
|
var doc = new Document();
|
|
var parent = doc.createElement('parent');
|
|
var child1 = doc.createElement('child1');
|
|
var child2 = doc.createElement('child1');
|
|
var grandchild = doc.createElement('grandchild');
|
|
|
|
doc.appendChild(parent);
|
|
parent.appendChild(child1);
|
|
parent.appendChild(child2);
|
|
child1.appendChild(grandchild);
|
|
|
|
var children = parent.getChildElements();
|
|
expect(children.length, equals(2));
|
|
expect(children[0], equals(child1));
|
|
expect(children[1], equals(child2));
|
|
});
|
|
}
|