1 description('Test for proper behavior of Range.insertNode when splitting text nodes');
3 var p = document.createElement('p');
4 var t1 = document.createTextNode('12345');
6 var t2 = document.createTextNode('ABCDE');
7 document.body.appendChild(p);
8 var r = document.createRange();
13 shouldBe("p.childNodes.length", "3");
14 shouldBe("p.childNodes[0]", "t1");
15 shouldBeEqualToString("p.childNodes[0].data", "12");
16 shouldBe("p.childNodes[1]", "t2");
17 shouldBeEqualToString("p.childNodes[1].data", "ABCDE");
18 shouldBeEqualToString("p.childNodes[2].data", "345");
20 var t3 = p.childNodes[2];
22 shouldBeFalse("r.collapsed");
23 shouldBe("r.commonAncestorContainer", "p");
24 shouldBe("r.startContainer", "t1");
25 shouldBe("r.startOffset", "2");
26 shouldBe("r.endContainer", "t3");
27 shouldBe("r.endOffset", "1");
28 shouldBeEqualToString("r.toString()", "ABCDE3")
30 // clean up after ourselves
31 document.body.removeChild(p);