File tree 2 files changed +25
-0
lines changed
test/unit/specs/directives
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ module.exports = {
114
114
merged . _asComponent = true
115
115
merged . _parent = this . vm
116
116
this . template = transclude ( this . template , merged )
117
+ // Important: mark the template as a root node so that
118
+ // custom element components don't get compiled twice.
119
+ // fixes #822
120
+ this . template . __vue__ = true
117
121
this . _linkFn = compile ( this . template , merged )
118
122
} else {
119
123
// to be resolved later
Original file line number Diff line number Diff line change @@ -210,6 +210,27 @@ if (_.inBrowser) {
210
210
} )
211
211
212
212
it ( 'custom element component' , function ( ) {
213
+ var vm = new Vue ( {
214
+ el : el ,
215
+ data : {
216
+ items : [ { a :1 } , { a :2 } , { a :3 } ]
217
+ } ,
218
+ template : '<test-component v-repeat="items"></test-component>' ,
219
+ components : {
220
+ 'test-component' : {
221
+ template : '{{$index}} {{a}}'
222
+ }
223
+ }
224
+ } )
225
+ expect ( el . innerHTML ) . toBe (
226
+ '<test-component>0 1</test-component>' +
227
+ '<test-component>1 2</test-component>' +
228
+ '<test-component>2 3</test-component>' +
229
+ '<!--v-repeat-->'
230
+ )
231
+ } )
232
+
233
+ it ( 'custom element component with replace:true' , function ( ) {
213
234
var vm = new Vue ( {
214
235
el : el ,
215
236
data : {
You can’t perform that action at this time.
0 commit comments