8000 add test case for container/replacer attrs with same name · Snoopbobb/vue@4c25d1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c25d1e

Browse files
committed
add test case for container/replacer attrs with same name
1 parent e65c895 commit 4c25d1e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/unit/specs/compiler/compile_spec.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,33 @@ if (_.inBrowser) {
242242
})
243243
})
244244

245+
it('should handle container/replacer directives with same name', function () {
246+
var parentSpy = jasmine.createSpy()
247+
var childSpy = jasmine.createSpy()
248+
vm = new Vue({
249+
el: el,
250+
template:
251+
'<div v-component="a" class="a" v-on="click:test(1)"></div>',
252+
methods: {
253+
test: parentSpy
254+
},
255+
components: {
256+
a: {
257+
template: '<div class="b" v-on="click:test(2)"></div>',
258+
replace: true,
259+
methods: {
260+
test: childSpy
261+
}
262+
}
263+
}
264+
})
265+
expect(vm.$el.firstChild.className).toBe('b a')
266+
var e = document.createEvent('HTMLEvents')
267+
e.initEvent('click', true, true)
268+
vm.$el.firstChild.dispatchEvent(e)
269+
expect(parentSpy).toHaveBeenCalledWith(1)
270+
expect(childSpy).toHaveBeenCalledWith(2)
271+
})
272+
245273
})
246274
}

0 commit comments

Comments
 (0)
0