+
+ it('keeps parent-describing nodes in place', function() {
+ var section = elementNodeFromXML('<section>Alice<x></x><div>a cat</div></section>'),
+ aliceText = section.contents()[0],
+ x = section.contents()[1],
+ lastDiv = section.contents()[2];
+
+ section.document.registerExtension({documentNode: {methods: {
+ object: {
+ describesParent: function() {
+ return this.getTagName() === 'x';
+ }
+ }
+ }}});
+
+ section.document.wrapNodes({
+ node1: aliceText,
+ node2: lastDiv,
+ _with: {tagName: 'header'}
+ });
+
+ expect(x.parent().sameNode(section)).to.be.true;
+ });