Skip to content

Commit 0846f68

Browse files
sqalhefeng
authored and
hefeng
committed
test(ssr): add basic directives test (vuejs#9166)
1 parent 2793b02 commit 0846f68

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

test/ssr/jasmine.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module.exports = {
44
'*.spec.js'
55
],
66
helpers: [
7-
require.resolve('@babel/register')
7+
require.resolve('@babel/register'),
8+
'../helpers/to-have-been-warned.js'
89
]
910
}

test/ssr/ssr-string.spec.js

+17
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,23 @@ describe('SSR: renderToString', () => {
794794
})
795795
})
796796

797+
it('should resolve custom directive', done => {
798+
renderToString(new Vue({
799+
directives: {
800+
test: {
801+
bind(node) {
802+
node.data.domProps = { textContent: 'test' }
803+
}
804+
}
805+
},
806+
template: '<div v-test></div>',
807+
}), (err, result) => {
808+
expect('Failed to resolve directive: test').not.toHaveBeenWarned()
809+
expect(result).toContain('<div data-server-rendered="true">test</div>')
810+
done()
811+
})
812+
})
813+
797814
it('custom directives', done => {
798815
const renderer = createRenderer({
799816
directives: {

0 commit comments

Comments
 (0)