File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -483,8 +483,8 @@ function processAttrs (el) {
483483 )
484484 }
485485 }
486- if ( ! el . component && (
487- isProp || platformMustUseProp ( el . tag , el . attrsMap . type , name )
486+ if ( isProp || (
487+ ! el . component && platformMustUseProp ( el . tag , el . attrsMap . type , name )
488488 ) ) {
489489 addProp ( el , name , value )
490490 } else {
Original file line number Diff line number Diff line change @@ -187,6 +187,25 @@ describe('Component', () => {
187187 } ) . then ( done )
188188 } )
189189
190+ it ( 'dynamic elements with domProps' , done => {
191+ const vm = new Vue ( {
192+ template : '<component :is="view" :value.prop="val"></component>' ,
193+ data : {
194+ view : 'input' ,
195+ val : 'hello'
196+ }
197+ } ) . $mount ( )
198+ expect ( vm . $el . tagName ) . toBe ( 'INPUT' )
199+ expect ( vm . $el . value ) . toBe ( 'hello' )
200+ vm . view = 'textarea'
201+ vm . val += ' world'
202+ waitForUpdate ( ( ) => {
203+ expect ( vm . $el . tagName ) . toBe ( 'TEXTAREA' )
204+ expect ( vm . $el . value ) . toBe ( 'hello world' )
205+ vm . view = ''
206+ } ) . then ( done )
207+ } )
208+
190209 it ( 'should compile parent template directives & content in parent scope' , done => {
191210 const vm = new Vue ( {
192211 data : {
Original file line number Diff line number Diff line change @@ -463,6 +463,14 @@ describe('parser', () => {
463463 expect ( ast . props ) . toBeUndefined ( )
464464 } )
465465
466+ it ( 'use prop when prop modifier was explicitly declared' , ( ) => {
467+ const ast = parse ( '<component is="textarea" :value.prop="val" />' , baseOptions )
468+ expect ( ast . attrs ) . toBeUndefined ( )
469+ expect ( ast . props . length ) . toBe ( 1 )
470+ expect ( ast . props [ 0 ] . name ) . toBe ( 'value' )
471+ expect ( ast . props [ 0 ] . value ) . toBe ( 'val' )
472+ } )
473+
466474 it ( 'pre/post transforms' , ( ) => {
467475 const options = extend ( { } , baseOptions )
468476 const spy1 = jasmine . createSpy ( 'preTransform' )
You can’t perform that action at this time.
0 commit comments