2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								import  {  parse  }  from  'compiler/parser/index'  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  optimize  }  from  'compiler/optimizer'  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  generate  }  from  'compiler/codegen'  
						 
					
						
							
								
									
										
										
										
											2017-06-30 08:56:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								import  {  isObject ,  extend  }  from  'shared/util'  
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								import  {  isReservedTag  }  from  'web/util/index'  
						 
					
						
							
								
									
										
										
										
											2017-05-15 15:35:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								import  {  baseOptions  }  from  'web/compiler/options'  
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								function  assertCodegen  ( template ,  generatedCode ,  . . . args )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  staticRenderFnCodes  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  generateOptions  =  baseOptions 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  proc  =  null 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  let  len  =  args . length 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  while  ( len -- )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  arg  =  args [ len ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( Array . isArray ( arg ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      staticRenderFnCodes  =  arg 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  if  ( isObject ( arg ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      generateOptions  =  arg 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  if  ( typeof  arg  ===  'function' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      proc  =  arg 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  const  ast  =  parse ( template ,  baseOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  optimize ( ast ,  baseOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  proc  &&  proc ( ast ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  const  res  =  generate ( ast ,  generateOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  expect ( res . render ) . toBe ( generatedCode ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  expect ( res . staticRenderFns ) . toEqual ( staticRenderFnCodes ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/* eslint-disable quotes */  
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								describe ( 'codegen' ,  ( )  = >  {  
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<p v-custom1:arg1.modifier="value1" v-custom2></p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 15:55:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{directives:[{name:"custom1",rawName:"v-custom1:arg1.modifier",value:(value1),expression:"value1",arg:"arg1",modifiers:{"modifier":true}},{name:"custom2",rawName:"v-custom2"}]})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-15 06:36:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate filters' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div :id="a | b | c">{{ d | e | f }}</div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',{attrs:{"id":_f("c")(_f("b")(a))}},[_v(_s(_f("f")(_f("e")(d))))])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-15 06:36:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 00:24:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate filters with no arguments' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div>{{ d | e() }}</div>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[_v(_s(_f("e")(d)))])} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-for directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><li v-for="item in items" :key="item.uid"></li></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 05:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',_l((items),function(item){return _c('li',{key:item.uid})}),0)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-14 02:55:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // iterator syntax
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><li v-for="(item, i) in items"></li></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 05:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',_l((items),function(item,i){return _c('li')}),0)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-14 02:55:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><li v-for="(item, key, index) in items"></li></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 05:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',_l((items),function(item,key,index){return _c('li')}),0)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 00:41:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // destructuring
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><li v-for="{ a, b } in items"></li></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 05:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',_l((items),function({ a, b }){return _c('li')}),0)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 00:41:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><li v-for="({ a, b }, key, index) in items"></li></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 05:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',_l((items),function({ a, b },key,index){return _c('li')}),0)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // v-for with extra element
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div><p></p><li v-for="item in items"></li></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 01:22:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[_c('p'),_l((items),function(item){return _c('li')})],2)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 00:41:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-if directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p v-if="show">hello</p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return (show)?_c('p',[_v("hello")]):_e()} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-else directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div><p v-if="show">hello</p><p v-else>world</p></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[(show)?_c('p',[_v("hello")]):_c('p',[_v("world")])])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-else-if directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><p v-if="show">hello</p><p v-else-if="hide">world</p></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[(show)?_c('p',[_v("hello")]):(hide)?_c('p',[_v("world")]):_e()])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-else-if with v-else directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><p v-if="show">hello</p><p v-else-if="hide">world</p><p v-else>bye</p></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[(show)?_c('p',[_v("hello")]):(hide)?_c('p',[_v("world")]):_c('p',[_v("bye")])])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-06 16:50:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate multi v-else-if with v-else directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-13 07:42:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><p v-if="show">hello</p><p v-else-if="hide">world</p><p v-else-if="3">elseif</p><p v-else>bye</p></div>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[(show)?_c('p',[_v("hello")]):(hide)?_c('p',[_v("world")]):(3)?_c('p',[_v("elseif")]):_c('p',[_v("bye")])])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 04:24:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 02:03:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate ref' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 02:03:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<p ref="component1"></p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{ref:"component1"})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 02:03:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate ref on v-for' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-18 02:03:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<ul><li v-for="item in items" ref="component1"></li></ul>' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 05:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('ul',_l((items),function(item){return _c('li',{ref:"component1",refInFor:true})}),0)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-25 08:51:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-bind directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p v-bind="test"></p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-30 08:46:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',_b({},'p',test,false))} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-bind with prop directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p v-bind.prop="test"></p>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',_b({},'p',test,true))} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-bind directive with sync modifier' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p v-bind.sync="test"></p>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',_b({},'p',test,false,true))} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-25 08:51:01 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-11 23:27:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-model directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input v-model="test">' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{directives:[{name:"model",rawName:"v-model",value:(test),expression:"test"}],domProps:{"value":(test)},on:{"input":function( $ event){if( $ event.target.composing)return;test= $ event.target.value}}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate multiline v-model directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input v-model="\n test \n">' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{directives:[{name:"model",rawName:"v-model",value:( \ n test  \ n),expression:" \\ n test  \\ n"}],domProps:{"value":( \ n test  \ n)},on:{"input":function( $ event){if( $ event.target.composing)return; \ n test  \ n= $ event.target.value}}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate multiline v-model directive on custom component' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<my-component v-model="\n test \n" />' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('my-component',{model:{value:( \ n test  \ n),callback:function ( $ $ v) { \ n test  \ n= $ $ v},expression:" \\ n test  \\ n"}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate template tag' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><template><p>{{hello}}</p></template></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 01:22:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[[_c('p',[_v(_s(hello))])]],2)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate single slot' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><slot></slot></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 01:22:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[_t("default")],2)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate named slot' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><slot name="one"></slot></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 01:22:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[_t("one")],2)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate slot fallback content' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-25 01:00:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div><slot><div>hi</div></slot></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-16 23:37:35 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[_t("default",function(){return [_c('div',[_v("hi")])]})],2)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate slot target' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p slot="one">hello world</p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-13 09:45:44 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{attrs:{"slot":"one"},slot:"one"},[_v("hello world")])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-05 05:25:39 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate scoped slot' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><template slot-scope="bar">{{ bar }}</template></foo>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('foo',{scopedSlots:_u([{key:"default",fn:function(bar){return [_v(_s(bar))]}}])})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><div slot-scope="bar">{{ bar }}</div></foo>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('foo',{scopedSlots:_u([{key:"default",fn:function(bar){return _c('div',{},[_v(_s(bar))])}}])})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate named scoped slot' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><template slot="foo" slot-scope="bar">{{ bar }}</template></foo>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('foo',{scopedSlots:_u([{key:"foo",fn:function(bar){return [_v(_s(bar))]}}])})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><div slot="foo" slot-scope="bar">{{ bar }}</div></foo>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('foo',{scopedSlots:_u([{key:"foo",fn:function(bar){return _c('div',{},[_v(_s(bar))])}}])})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-01-26 11:34:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate dynamic scoped slot' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><template :slot="foo" slot-scope="bar">{{ bar }}</template></foo>' , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 21:52:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('foo',{scopedSlots:_u([{key:foo,fn:function(bar){return [_v(_s(bar))]}}],null,true)})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-26 11:34:06 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-01 13:33:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate scoped slot with multiline v-if' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><template v-if="\nshow\n" slot-scope="bar">{{ bar }}</template></foo>' , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 21:52:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('foo',{scopedSlots:_u([{key:"default",fn:function(bar){return ( \ nshow \ n)?[_v(_s(bar))]:undefined}}],null,true)})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-01 13:33:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><div v-if="\nshow\n" slot="foo" slot-scope="bar">{{ bar }}</div></foo>' , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 21:52:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c( \ 'foo \ ',{scopedSlots:_u([{key:"foo",fn:function(bar){return ( \ nshow \ n)?_c( \ 'div \ ',{},[_v(_s(bar))]):_e()}}],null,true)})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-05 11:39:35 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate scoped slot with new slot syntax' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<foo><template v-if="show" #default="bar">{{ bar }}</template></foo>' , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-21 21:52:15 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('foo',{scopedSlots:_u([(show)?{key:"default",fn:function(bar){return [_v(_s(bar))]}}:null],null,true)})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-01 13:33:59 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate class binding' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // static
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p class="class1">hello world</p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{staticClass:"class1"},[_v("hello world")])} ` , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // dynamic
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p :class="class1">hello world</p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{class:class1},[_v("hello world")])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate style binding' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p :style="error">hello world</p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{style:(error)},[_v("hello world")])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate v-show directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p v-show="shown">hello world</p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{directives:[{name:"show",rawName:"v-show",value:(shown),expression:"shown"}]},[_v("hello world")])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-20 05:52:10 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate DOM props with v-bind directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-19 00:36:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // input + value
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input :value="msg">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{domProps:{"value":msg}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-19 00:36:05 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // non input
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-15 04:47:28 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<p :value="msg"/>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('p',{attrs:{"value":msg}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate attrs with v-bind directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input :name="field1">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{attrs:{"name":field1}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-29 22:45:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate static attrs' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input name="field1">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{attrs:{"name":"field1"}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with v-on directive' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":onInput}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with method call' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput($event);">' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 01:20:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){return onInput( $ event);}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // empty arguments
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput();">' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 01:20:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){return onInput();}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // without semicolon
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput($event)">' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 01:20:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){return onInput( $ event)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // multiple args
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput($event, \'abc\', 5);">' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 01:20:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){return onInput( $ event, 'abc', 5);}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // expression in args
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput($event, 2+2);">' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 01:20:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){return onInput( $ event, 2+2);}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // tricky symbols in args
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-21 01:20:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` <input @input="onInput(');[ \\ '());');"> ` , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){onInput(');[ \\ '());');}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-25 21:04:36 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // function name including a `function` part (#9920)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="functionName()">' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){return functionName()}}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-09 06:09:53 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with multiple statements' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // normal function
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput1();onInput2()">' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){onInput1();onInput2()}}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // function with multiple args
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="onInput1($event, \'text\');onInput2(\'text2\', $event)">' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){onInput1( $ event, 'text');onInput2('text2',  $ event)}}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with keycode' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.enter="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"enter",13, $ event.key,"Enter"))return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // multiple keycodes (delete)
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.delete="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"delete",[8,46], $ event.key,["Backspace","Delete","Del"]))return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-06 04:26:58 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // multiple keycodes (esc)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.esc="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"esc",27, $ event.key,["Esc","Escape"]))return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-06 04:26:58 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // multiple keycodes (space)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.space="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"space",32, $ event.key,[" ","Spacebar"]))return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-22 23:10:36 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-19 00:17:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // multiple keycodes (chained)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @keydown.enter.delete="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"keydown":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"enter",13, $ event.key,"Enter")&&_k( $ event.keyCode,"delete",[8,46], $ event.key,["Backspace","Delete","Del"]))return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-19 00:17:17 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-22 23:10:36 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // number keycode
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.13="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){if(! $ event.type.indexOf('key')&& $ event.keyCode!==13)return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-22 23:35:33 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // custom keycode
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.custom="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"custom",undefined, $ event.key,undefined))return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 06:34:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with generic modifiers' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.stop="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){ $ event.stopPropagation();return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.prevent="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){ $ event.preventDefault();return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.self="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){if( $ event.target !==  $ event.currentTarget)return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 06:34:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-07 19:33:09 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  // GitHub Issues #5146
 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 09:42:14 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with generic modifiers and keycode correct order' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @keydown.enter.prevent="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"keydown":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"enter",13, $ event.key,"Enter"))return null; $ event.preventDefault();return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 09:42:14 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @keydown.enter.stop="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"keydown":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"enter",13, $ event.key,"Enter"))return null; $ event.stopPropagation();return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-10 09:42:14 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 06:34:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with mouse event modifiers' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 22:46:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 06:34:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<input @click.ctrl="onClick">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"click":function( $ event){if(! $ event.ctrlKey)return null;return onClick.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 22:46:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 06:34:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<input @click.shift="onClick">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"click":function( $ event){if(! $ event.shiftKey)return null;return onClick.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 22:46:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 06:34:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<input @click.alt="onClick">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"click":function( $ event){if(! $ event.altKey)return null;return onClick.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 22:46:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-22 06:34:03 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<input @click.meta="onClick">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"click":function( $ event){if(! $ event.metaKey)return null;return onClick.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-20 22:46:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-05 00:37:00 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @click.exact="onClick">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"click":function( $ event){if( $ event.ctrlKey|| $ event.shiftKey|| $ event.altKey|| $ event.metaKey)return null;return onClick.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-05 00:37:00 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @click.ctrl.exact="onClick">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"click":function( $ event){if(! $ event.ctrlKey)return null;if( $ event.shiftKey|| $ event.altKey|| $ event.metaKey)return null;return onClick.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-05 00:37:00 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-06 16:50:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with multiple modifiers' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.stop.prevent.self="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){ $ event.stopPropagation(); $ event.preventDefault();if( $ event.target !==  $ event.currentTarget)return null;return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with capture modifier' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.capture="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"!input":function( $ event){return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-01 01:15:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with once modifier' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.once="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"~input":function( $ event){return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-01 01:15:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with capture and once modifier' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.capture.once="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"~!input":function( $ event){return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-01 01:15:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with once and capture modifier' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input.once.capture="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"~!input":function( $ event){return onInput.apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-01 01:15:18 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with inline statement' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-06 16:50:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<input @input="current++">' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function( $ event){current++}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate events with inline function expression' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // normal function
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="function () { current++ }">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function () { current++ }}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-18 16:19:41 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // normal named function
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="function fn () { current++ }">' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function fn () { current++ }}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // arrow with no args
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="()=>current++">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":()=>current++}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // arrow with parens, single arg
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="(e) => current++">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":(e) => current++}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // arrow with parens, multi args
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="(a, b, c) => current++">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":(a, b, c) => current++}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // arrow with destructuring
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="({ a, b }) => current++">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":({ a, b }) => current++}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // arrow single arg no parens
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input="e=>current++">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":e=>current++}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-08 11:27:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // with modifiers
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` <input @keyup.enter="e=>current++"> ` , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"keyup":function( $ event){if(! $ event.type.indexOf('key')&&_k( $ event.keyCode,"enter",13, $ event.key,"Enter"))return null;return (e=>current++).apply(null, arguments)}}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-08 11:27:43 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 11:18:38 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 07:30:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  // #3893
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'should not treat handler with unexpected whitespace as inline statement' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<input @input=" onInput ">' , 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-22 02:11:11 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":onInput}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-11 07:30:19 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate unhandled events' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-06 16:50:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<input @input="current++">' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":function(){}}})} ` , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ast  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ast . events . input  =  undefined 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate multiple event handlers' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-06 16:50:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<input @input="current++" @input.stop="onInput">' , 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-21 22:16:45 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('input',{on:{"input":[function( $ event){current++},function( $ event){ $ event.stopPropagation();return onInput.apply(null, arguments)}]}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate component' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<my-component name="mycomponent1" :msg="msg" @notify="onNotify"><div>hi</div></my-component>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('my-component',{attrs:{"name":"mycomponent1","msg":msg},on:{"notify":onNotify}},[_c('div',[_v("hi")])])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-13 23:38:50 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate svg component with children' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<svg><my-comp><circle :r="10"></circle></my-comp></svg>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-15 01:22:54 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('svg',[_c('my-comp',[_c('circle',{attrs:{"r":10}})])],1)} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-13 23:38:50 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate is attribute' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div is="component1"></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c("component1",{tag:"div"})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<div :is="component1"></div>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c(component1,{tag:"div"})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-25 00:50:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // maybe a component and normalize type should be 1
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div><div is="component1"></div></div>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[_c("component1",{tag:"div"})],1)} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 08:57:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate component with inline-template' ,  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // have "inline-template'"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 07:08:08 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      '<my-component inline-template><p><span>hello world</span></p></my-component>' , 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-06 00:17:36 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('my-component',{inlineTemplate:{render:function(){with(this){return _m(0)}},staticRenderFns:[function(){with(this){return _c('p',[_c('span',[_v("hello world")])])}}]}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-06 16:50:49 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    // "have inline-template attrs, but not having exactly one child element
 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<my-component inline-template><hr><hr></my-component>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('my-component',{inlineTemplate:{render:function(){with(this){return _c('hr')}},staticRenderFns:[]}})} ` 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-05 05:49:27 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<my-component inline-template></my-component>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('my-component',{})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // have "is" attribute
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div is="myComponent" inline-template><div></div></div>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c("myComponent",{tag:"div",inlineTemplate:{render:function(){with(this){return _c('div')}},staticRenderFns:[]}})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div is="myComponent" inline-template></div>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c("myComponent",{tag:"div"})} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    expect ( 'Inline-template components must have exactly one child element.' ) . toHaveBeenWarned ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-05-20 07:56:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    expect ( console . error . mock . calls . length ) . toBe ( 3 ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 07:03:00 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate static trees inside v-for' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
									
										
										
										
											2016-11-18 07:08:08 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` <div><div v-for="i in 10"><p><span></span></p></div></div> ` , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-12 05:51:40 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',_l((10),function(i){return _c('div',[_m(0,true)])}),0)} ` , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      [ ` with(this){return _c('p',[_c('span')])} ` ] 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-09 07:03:00 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 02:28:32 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate component with v-for' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // normalize type: 2
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<div><child></child><template v-for="item in list">{{ item }}</template></div>' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[_c('child'),_l((list),function(item){return [_v(_s(item))]})],2)} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-30 08:56:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'generate component with comment' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  options  =  extend ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      comments : true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ,  baseOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  template  =  '<div><!--comment--></div>' 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-20 06:09:21 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    const  generatedCode  =  ` with(this){return _c('div',[_e("comment")])} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  ast  =  parse ( template ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    optimize ( ast ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  res  =  generate ( ast ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    expect ( res . render ) . toBe ( generatedCode ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  // #6150
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'generate comments with special characters' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  options  =  extend ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      comments : true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ,  baseOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  template  =  '<div><!--\n\'comment\'\n--></div>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  generatedCode  =  ` with(this){return _c('div',[_e(" \\ n'comment' \\ n")])} ` 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-30 08:56:23 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  ast  =  parse ( template ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    optimize ( ast ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  res  =  generate ( ast ,  options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    expect ( res . render ) . toBe ( generatedCode ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-25 01:01:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  // #8041
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'does not squash templates inside v-pre' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  template  =  '<div v-pre><template><p>{{msg}}</p></template></div>' 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  generatedCode  =  ` with(this){return _m(0)} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  renderFn  =  ` with(this){return _c('div',{pre:true},[_c('template',[_c('p',[_v("{{msg}}")])])],2)} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  ast  =  parse ( template ,  baseOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    optimize ( ast ,  baseOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  res  =  generate ( ast ,  baseOptions ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    expect ( res . render ) . toBe ( generatedCode ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    expect ( res . staticRenderFns ) . toEqual ( [ renderFn ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								  it ( 'not specified ast type' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    const  res  =  generate ( null ,  baseOptions ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    expect ( res . render ) . toBe ( ` with(this){return _c("div")} ` ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    expect ( res . staticRenderFns ) . toEqual ( [ ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'not specified directives option' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      '<p v-if="show">hello world</p>' , 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-05 09:29:51 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      ` with(this){return (show)?_c('p',[_v("hello world")]):_e()} ` , 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								      {  isReservedTag  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-04 23:51:29 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  // #9142
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  it ( 'should compile single v-for component inside template' ,  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    assertCodegen ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` <div><template v-if="ok"><foo v-for="i in 1" :key="i"></foo></template></div> ` , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      ` with(this){return _c('div',[(ok)?_l((1),function(i){return _c('foo',{key:i})}):_e()],2)} ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-19 01:18:31 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								} )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* eslint-enable quotes */