test('editor#selectSections works when given an empty array', (assert) => { const mobiledoc = Helpers.mobiledoc.build(({post, markupSection, marker}) => { return post([markupSection('p', [marker('abc')])]); }); editor = new Editor({mobiledoc}); editor.render(editorElement); assert.selectedText('', 'precond - no text selected'); const section = editor.post.sections.head; editor.selectSections([section]); assert.selectedText('abc', 'section is selected'); editor.selectSections([]); assert.selectedText(null, 'no text selected after selecting no sections'); });
test('selecting a card and deleting deletes the card', (assert) => { const mobiledoc = Helpers.mobiledoc.build(({post, cardSection}) => { return post([cardSection(positionCard.name)]); }); editor = new Editor({mobiledoc, cards: [positionCard]}); editor.render(editorElement); assert.hasElement('#my-simple-card', 'precond - renders card'); assert.hasNoElement('#editor p', 'precond - has no markup section'); editor.selectSections([editor.post.sections.head]); Helpers.dom.triggerDelete(editor); assert.hasNoElement('#my-simple-card', 'has no card after delete'); assert.hasElement('#editor p', 'has blank markup section'); });