Skip to content

Commit

Permalink
test(ssr): add basic directives test (#9166)
Browse files Browse the repository at this point in the history
  • Loading branch information
sqal authored and yyx990803 committed Dec 9, 2018
1 parent dadc918 commit a89384c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/ssr/jasmine.js
Expand Up @@ -4,6 +4,7 @@ module.exports = {
'*.spec.js'
],
helpers: [
require.resolve('@babel/register')
require.resolve('@babel/register'),
'../helpers/to-have-been-warned.js'
]
}
17 changes: 17 additions & 0 deletions test/ssr/ssr-string.spec.js
Expand Up @@ -794,6 +794,23 @@ describe('SSR: renderToString', () => {
})
})

it('should resolve custom directive', done => {
renderToString(new Vue({
directives: {
test: {
bind(node) {
node.data.domProps = { textContent: 'test' }
}
}
},
template: '<div v-test></div>',
}), (err, result) => {
expect('Failed to resolve directive: test').not.toHaveBeenWarned()
expect(result).toContain('<div data-server-rendered="true">test</div>')
done()
})
})

it('custom directives', done => {
const renderer = createRenderer({
directives: {
Expand Down

0 comments on commit a89384c

Please sign in to comment.