Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(ssr): should not warn for custom directives that do not have ssr …
…implementation

fix #9167
  • Loading branch information
yyx990803 committed Dec 9, 2018
1 parent a89384c commit 780dac5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/server/render.js
Expand Up @@ -326,7 +326,7 @@ function renderStartingTag (node: VNode, context) {
for (let i = 0; i < dirs.length; i++) {
const name = dirs[i].name
if (name !== 'show') {
const dirRenderer = resolveAsset(context, 'directives', name, true)
const dirRenderer = resolveAsset(context, 'directives', name)
if (dirRenderer) {
// directives mutate the node's data
// which then gets rendered by modules
Expand Down
33 changes: 16 additions & 17 deletions test/ssr/ssr-string.spec.js
Expand Up @@ -794,23 +794,6 @@ 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 Expand Up @@ -843,6 +826,22 @@ describe('SSR: renderToString', () => {
})
})

it('should not warn for custom directives that do not have server-side implementation', done => {
renderToString(new Vue({
directives: {
test: {
bind() {
// noop
}
}
},
template: '<div v-test></div>',
}), () => {
expect('Failed to resolve directive: test').not.toHaveBeenWarned()
done()
})
})

it('_scopeId', done => {
renderVmWithOptions({
_scopeId: '_v-parent',
Expand Down

0 comments on commit 780dac5

Please sign in to comment.