+ it('appends node when inserting node at index out of range', function() {
+ var doc = getDocumentFromXML('<div></div>');
+
+ var test1 = doc.root.insertAtIndex({tagName: 'test1'}, 0),
+ test2 = doc.root.insertAtIndex({tagName: 'test1'}, 10);
+
+ expect(doc.root.contents()[0].sameNode(test1)).to.equal(true, 'inserting at index 0 of empty nodes appends node');
+ expect(doc.root.contents().length).to.equal(1, 'inserting at index out of range does nothing');
+ expect(test2).to.equal(undefined, 'inserting at index out of range returns undefined');
+ });
+