diff --git a/src/js/models/post.js b/src/js/models/post.js index 43cecbdbe..60f90a139 100644 --- a/src/js/models/post.js +++ b/src/js/models/post.js @@ -7,12 +7,15 @@ export default class Post { this.sections = []; } appendSection(section) { + section.post = this; this.sections.push(section); } prependSection(section) { + section.post = this; this.sections.unshift(section); } replaceSection(section, newSection) { + section.post = this; this.insertSectionAfter(newSection, section); this.removeSection(section); } @@ -37,6 +40,7 @@ export default class Post { } insertSectionAfter(section, previousSection) { + section.post = this; let foundIndex = -1; for (let i=0; i { + const done = assert.async(); + + editor = new Editor(editorElement, {mobiledoc: mobileDocWith2Sections}); + + let firstSection = $('p:contains(first section)')[0]; + let secondSection = $('p:contains(second section)')[0]; + + Helpers.dom.selectText('section', firstSection, + 'second', secondSection); + + Helpers.dom.triggerEvent(document, 'mouseup'); + + setTimeout(() => { + assert.equal(editor.activeSections.length, 2, 'selects 2 sections'); + done(); + }); +});