-
Notifications
You must be signed in to change notification settings - Fork 134
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Steps to Reproduce
- a
- b [cursor]
Paste two or more thoughts at once:
- x
- y
Current Behavior
- a
- x
- y
(b is still in thoughtIndex)
Expected Behavior
- a
- b
- x
- y
Tests
Write a failing unit test (recommend doing this first for TDD). Test that both contextIndex and thoughtIndex are correct after pasting.
This is a rough draft of a unit test for importHtml.js but it is failing differently than I expected. You will have to fix this or write your own.
it('paste multiple thoughts after the cursor', () => {
/** Import HTML and merge into state. */
const importHtmlReducer = (state, insertionPath, html) => {
const { contextIndexUpdates, thoughtIndexUpdates } = importHtml(state, insertionPath, html)
return {
...state,
thoughts: {
contextIndex: contextIndexUpdates,
thoughtIndex: thoughtIndexUpdates,
}
}
}
const initialHtml = `
<li>a<ul>
<li>b</li>
</ul></li>
`
const importedHtml = `
<li>x</li>
<li>y</li>
`
const state1 = importHtmlReducer(initialState, RANKED_ROOT, initialHtml)
const state2 = importHtmlReducer(state1, [{ value: 'a', rank: 0 }, { value: 'b', rank: 1 }], importedHtml)
const exported = exportContext(state2, [ROOT_TOKEN], 'text/plaintext')
expect(exported).toBe(`- __ROOT__
- a
- b
- x
- y`)
})Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working