File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
test/unit/specs/directives Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ module.exports = {
114114 merged . _asComponent = true
115115 merged . _parent = this . vm
116116 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
117121 this . _linkFn = compile ( this . template , merged )
118122 } else {
119123 // to be resolved later
Original file line number Diff line number Diff line change @@ -210,6 +210,27 @@ if (_.inBrowser) {
210210 } )
211211
212212 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 ( ) {
213234 var vm = new Vue ( {
214235 el : el ,
215236 data : {
You can’t perform that action at this time.
0 commit comments