-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vue2):
augmentedCreateElement
should pass HTML attributes (#6282)
fix(vue2): `augmentedCreateElement` does not pass HTML attributes properly Co-authored-by: Haroen Viaene <hello@haroen.me>
- Loading branch information
1 parent
60c3f20
commit e0d4c68
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
packages/vue-instantsearch/src/util/__tests__/renderCompat.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { mount } from '../../../test/utils'; | ||
import { renderCompat } from '../vue-compat'; | ||
|
||
describe('renderCompat', () => { | ||
it('should handle function components that return multiple children', () => { | ||
const wrapper = mount({ | ||
render: renderCompat((h) => { | ||
function Component({ text }) { | ||
return h( | ||
'div', | ||
{ attrs: { 'data-text': text } }, | ||
h('span', {}, ['1']), | ||
h('span', {}, '2') | ||
); | ||
} | ||
return h(Component, { text: 'Hello world' }); | ||
}), | ||
}); | ||
|
||
expect(wrapper.html()).toMatchInlineSnapshot(` | ||
<div data-text="Hello world"> | ||
<span> | ||
1 | ||
</span> | ||
<span> | ||
2 | ||
</span> | ||
</div> | ||
`); | ||
}); | ||
|
||
it('should map props to attrs when using a HTML tag', () => { | ||
const wrapper = mount({ | ||
render: renderCompat((h) => { | ||
return h('img', { | ||
src: 'http://algolia.com/image.png', | ||
alt: 'Some image', | ||
}); | ||
}), | ||
}); | ||
|
||
expect(wrapper.html()).toMatchInlineSnapshot(` | ||
<img src="http://algolia.com/image.png" | ||
alt="Some image" | ||
> | ||
`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters