Skip to content

Commit

Permalink
Updated from buggy fragdom version
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Helvik committed Nov 6, 2019
1 parent 77e8693 commit bb330c0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "@adrianhelvik/vdom",
"version": "1.3.7",
"version": "1.3.8",
"main": "dist/index.js",
"module": "src/index.js",
"author": "Adrian Helvik <adrian.helvik@specifique.no>",
Expand Down Expand Up @@ -33,6 +33,6 @@
]
},
"dependencies": {
"@adrianhelvik/fragdom": "^2.1.10"
"@adrianhelvik/fragdom": "^2.1.12"
}
}
32 changes: 32 additions & 0 deletions src/applyDiff.spec.js
Expand Up @@ -214,6 +214,29 @@ describe('on child elements', () => {

expect(pending[0].target.parentNode.tagName).toBe('DIV')
})

it('can replace a text node with false', () => {
const diffA = createDiff(null, <div>Hello</div>)
const diffB = createDiff(<div>Hello</div>, <div>{false}</div>)

applyDiff(container, diffA)
applyDiff(container, diffB)

expect(diffB).toEqual([{ type: 'replace node', node: false, path: [0, 0] }])

expect(fragContainer.debug().split('\n')).toEqual([
/************************/
'<div>',
' <div>',
' <></>',
' </div>',
'</div>',
])

fragdomError(() => {
expect(container.innerHTML).toBe('<div></div>')
})
})
})

it('can set initial props', () => {
Expand Down Expand Up @@ -507,3 +530,12 @@ describe('replace child bugfix', () => {
expect(root.innerHTML).toBe('Hello123')
})
})

function fragdomError(fn) {
try {
fn()
} catch (e) {
e.message = `[Caused by Fragdom] ${e.message}`
throw e
}
}

0 comments on commit bb330c0

Please sign in to comment.