|
@@ -72,6 +72,7 @@ describe('Usage', () => {
|
|
|
it('v-for-iterator', createRenderTestCase('recycle-list/v-for-iterator'))
|
|
it('v-for-iterator', createRenderTestCase('recycle-list/v-for-iterator'))
|
|
|
it('v-on', createRenderTestCase('recycle-list/v-on'))
|
|
it('v-on', createRenderTestCase('recycle-list/v-on'))
|
|
|
it('v-on-inline', createRenderTestCase('recycle-list/v-on-inline'))
|
|
it('v-on-inline', createRenderTestCase('recycle-list/v-on-inline'))
|
|
|
|
|
+ it('v-once', createRenderTestCase('recycle-list/v-once'))
|
|
|
|
|
|
|
|
it('stateless component', done => {
|
|
it('stateless component', done => {
|
|
|
compileWithDeps('recycle-list/components/stateless.vue', [{
|
|
compileWithDeps('recycle-list/components/stateless.vue', [{
|
|
@@ -143,35 +144,35 @@ describe('Usage', () => {
|
|
|
expect(getRoot(instance)).toEqual(target)
|
|
expect(getRoot(instance)).toEqual(target)
|
|
|
tasks.length = 0
|
|
tasks.length = 0
|
|
|
|
|
|
|
|
- // trigger component hooks
|
|
|
|
|
- instance.$triggerHook(
|
|
|
|
|
- 2, // cid of the virtual component template
|
|
|
|
|
- 'create', // lifecycle hook name
|
|
|
|
|
-
|
|
|
|
|
- // arguments for the callback
|
|
|
|
|
- [
|
|
|
|
|
- 'x-1', // componentId of the virtual component
|
|
|
|
|
- { start: 3 } // propsData of the virtual component
|
|
|
|
|
- ]
|
|
|
|
|
- )
|
|
|
|
|
- instance.$triggerHook(2, 'create', ['x-2', { start: 11 }])
|
|
|
|
|
-
|
|
|
|
|
- // the state (_data) of the virtual component should be sent to native
|
|
|
|
|
- expect(tasks.length).toEqual(2)
|
|
|
|
|
- expect(tasks[0].method).toEqual('updateComponentData')
|
|
|
|
|
- expect(tasks[0].args).toEqual(['x-1', { count: 6 }, ''])
|
|
|
|
|
- expect(tasks[1].method).toEqual('updateComponentData')
|
|
|
|
|
- expect(tasks[1].args).toEqual(['x-2', { count: 22 }, ''])
|
|
|
|
|
-
|
|
|
|
|
- instance.$triggerHook('x-1', 'attach')
|
|
|
|
|
- instance.$triggerHook('x-2', 'attach')
|
|
|
|
|
- tasks.length = 0
|
|
|
|
|
-
|
|
|
|
|
- // simulate a click event
|
|
|
|
|
- // the event will be caught by the virtual component template and
|
|
|
|
|
- // should be dispatched to virtual component according to the componentId
|
|
|
|
|
- const event = getEvents(instance)[0]
|
|
|
|
|
- fireEvent(instance, event.ref, 'click', { componentId: 'x-1' })
|
|
|
|
|
|
|
+ // // trigger component hooks
|
|
|
|
|
+ // instance.$triggerHook(
|
|
|
|
|
+ // 2, // cid of the virtual component template
|
|
|
|
|
+ // 'create', // lifecycle hook name
|
|
|
|
|
+
|
|
|
|
|
+ // // arguments for the callback
|
|
|
|
|
+ // [
|
|
|
|
|
+ // 'x-1', // componentId of the virtual component
|
|
|
|
|
+ // { start: 3 } // propsData of the virtual component
|
|
|
|
|
+ // ]
|
|
|
|
|
+ // )
|
|
|
|
|
+ // instance.$triggerHook(2, 'create', ['x-2', { start: 11 }])
|
|
|
|
|
+
|
|
|
|
|
+ // // the state (_data) of the virtual component should be sent to native
|
|
|
|
|
+ // expect(tasks.length).toEqual(2)
|
|
|
|
|
+ // expect(tasks[0].method).toEqual('updateComponentData')
|
|
|
|
|
+ // expect(tasks[0].args).toEqual(['x-1', { count: 6 }, ''])
|
|
|
|
|
+ // expect(tasks[1].method).toEqual('updateComponentData')
|
|
|
|
|
+ // expect(tasks[1].args).toEqual(['x-2', { count: 22 }, ''])
|
|
|
|
|
+
|
|
|
|
|
+ // instance.$triggerHook('x-1', 'attach')
|
|
|
|
|
+ // instance.$triggerHook('x-2', 'attach')
|
|
|
|
|
+ // tasks.length = 0
|
|
|
|
|
+
|
|
|
|
|
+ // // simulate a click event
|
|
|
|
|
+ // // the event will be caught by the virtual component template and
|
|
|
|
|
+ // // should be dispatched to virtual component according to the componentId
|
|
|
|
|
+ // const event = getEvents(instance)[0]
|
|
|
|
|
+ // fireEvent(instance, event.ref, 'click', { componentId: 'x-1' })
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
// expect(tasks.length).toEqual(1)
|
|
// expect(tasks.length).toEqual(1)
|
|
|
// expect(tasks[0].method).toEqual('updateComponentData')
|
|
// expect(tasks[0].method).toEqual('updateComponentData')
|