|
|
@@ -147,16 +147,22 @@ describe('codegen', () => {
|
|
|
})
|
|
|
|
|
|
it('generate transition', () => {
|
|
|
+ // without key, should auto-set unique key
|
|
|
assertCodegen(
|
|
|
'<p transition="expand">hello world</p>',
|
|
|
- `with(this){return _h('p',{transition:"expand"},["hello world"])}`
|
|
|
+ `with(this){return _h('p',{transition:"expand",key:"__t18__"},["hello world"])}`
|
|
|
+ )
|
|
|
+ // with key
|
|
|
+ assertCodegen(
|
|
|
+ '<p transition="expand" key="1">hello world</p>',
|
|
|
+ `with(this){return _h('p',{key:"1",transition:"expand"},["hello world"])}`
|
|
|
)
|
|
|
})
|
|
|
|
|
|
it('generate dynamic transition with transition on appear', () => {
|
|
|
assertCodegen(
|
|
|
- `<p :transition="{name:'expand',appear:true}">hello world</p>`,
|
|
|
- `with(this){return _h('p',{transition:{name:'expand',appear:true}},["hello world"])}`
|
|
|
+ `<p :transition="{name:'expand',appear:true}" :key="test">hello world</p>`,
|
|
|
+ `with(this){return _h('p',{key:test,transition:{name:'expand',appear:true}},["hello world"])}`
|
|
|
)
|
|
|
})
|
|
|
|