diff --git a/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts b/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts index 4ac9489f6..23decf4e1 100644 --- a/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts @@ -24,13 +24,13 @@ describe('compiler: element transform', () => { ) expect(code).toMatchSnapshot() expect(code).contains('
"') - expect(ir.effect.length).toBe(0) + expect(ir.block.effect).lengthOf(0) }) test('v-bind="obj"', () => { const { code, ir } = compileWithElementTransform(``) expect(code).toMatchSnapshot() - expect(ir.effect).toMatchObject([ + expect(ir.block.effect).toMatchObject([ { expressions: [ { @@ -62,7 +62,7 @@ describe('compiler: element transform', () => { ``, ) expect(code).toMatchSnapshot() - expect(ir.effect).toMatchObject([ + expect(ir.block.effect).toMatchObject([ { expressions: [ { @@ -110,7 +110,7 @@ describe('compiler: element transform', () => { ``, ) expect(code).toMatchSnapshot() - expect(ir.effect).toMatchObject([ + expect(ir.block.effect).toMatchObject([ { expressions: [ { @@ -158,7 +158,7 @@ describe('compiler: element transform', () => { ``, ) expect(code).toMatchSnapshot() - expect(ir.effect).toMatchObject([ + expect(ir.block.effect).toMatchObject([ { expressions: [ { @@ -225,7 +225,7 @@ describe('compiler: element transform', () => { ) expect(code).toMatchSnapshot() - expect(ir.operation).toMatchObject([ + expect(ir.block.operation).toMatchObject([ { type: IRNodeTypes.SET_EVENT, element: 1, @@ -261,7 +261,7 @@ describe('compiler: element transform', () => { ) expect(code).toMatchSnapshot() - expect(ir.effect).toMatchObject([ + expect(ir.block.effect).toMatchObject([ { expressions: [ { @@ -306,7 +306,7 @@ describe('compiler: element transform', () => { expect(code).toMatchSnapshot() - expect(ir.effect).toMatchObject([ + expect(ir.block.effect).toMatchObject([ { expressions: [ { diff --git a/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts b/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts index 204bab38e..68bf140f8 100644 --- a/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/vBind.spec.ts @@ -18,15 +18,15 @@ describe('compiler v-bind', () => { test('basic', () => { const { ir, code } = compileWithVBind(``) - expect(ir.dynamic.children[0]).toMatchObject({ + expect(ir.block.dynamic.children[0]).toMatchObject({ id: 1, flags: DynamicFlag.REFERENCED, }) expect(ir.template).toEqual(['']) - expect(ir.effect).lengthOf(1) - expect(ir.effect[0].expressions).lengthOf(1) - expect(ir.effect[0].operations).lengthOf(1) - expect(ir.effect[0]).toMatchObject({ + expect(ir.block.effect).lengthOf(1) + expect(ir.block.effect[0].expressions).lengthOf(1) + expect(ir.block.effect[0].operations).lengthOf(1) + expect(ir.block.effect[0]).toMatchObject({ expressions: [ { type: NodeTypes.SIMPLE_EXPRESSION, @@ -80,7 +80,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ type: IRNodeTypes.SET_PROP, prop: { key: { @@ -110,7 +110,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ type: IRNodeTypes.SET_PROP, prop: { key: { @@ -133,7 +133,7 @@ describe('compiler v-bind', () => { ``, ) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ type: IRNodeTypes.SET_DYNAMIC_PROPS, element: 1, props: [ @@ -179,7 +179,7 @@ describe('compiler v-bind', () => { ``, ) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ type: IRNodeTypes.SET_DYNAMIC_PROPS, element: 1, props: [ @@ -267,7 +267,7 @@ describe('compiler v-bind', () => { test('.camel modifier', () => { const { ir, code } = compileWithVBind(``) - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `fooBar`, @@ -292,7 +292,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `fooBar`, @@ -315,7 +315,7 @@ describe('compiler v-bind', () => { test('.camel modifier w/ dynamic arg', () => { const { ir, code } = compileWithVBind(``) - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ type: IRNodeTypes.SET_DYNAMIC_PROPS, props: [ [ @@ -350,7 +350,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `fooBar`, @@ -374,7 +374,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `fooBar`, @@ -398,7 +398,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ type: IRNodeTypes.SET_DYNAMIC_PROPS, props: [ [ @@ -431,7 +431,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `fooBar`, @@ -455,7 +455,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `fooBar`, @@ -479,7 +479,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `foo-bar`, @@ -503,7 +503,7 @@ describe('compiler v-bind', () => { const { ir, code } = compileWithVBind(``) expect(code).matchSnapshot() - expect(ir.effect[0].operations[0]).toMatchObject({ + expect(ir.block.effect[0].operations[0]).toMatchObject({ prop: { key: { content: `foo-bar`, diff --git a/packages/compiler-vapor/__tests__/transforms/vFor.spec.ts b/packages/compiler-vapor/__tests__/transforms/vFor.spec.ts index 0ed9fc1d9..768ce03be 100644 --- a/packages/compiler-vapor/__tests__/transforms/vFor.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/vFor.spec.ts @@ -28,7 +28,7 @@ describe('compiler: v-for', () => { expect(vaporHelpers).contains('createFor') expect(helpers.size).toBe(0) expect(ir.template).toEqual(['']) - expect(ir.operation).toMatchObject([ + expect(ir.block.operation).toMatchObject([ { type: IRNodeTypes.FOR, id: 1, @@ -43,7 +43,7 @@ describe('compiler: v-for', () => { key: undefined, index: undefined, render: { - type: IRNodeTypes.BLOCK_FUNCTION, + type: IRNodeTypes.BLOCK, templateIndex: 0, }, keyProperty: { @@ -52,13 +52,13 @@ describe('compiler: v-for', () => { }, }, ]) - expect(ir.returns).toEqual([1]) - expect(ir.dynamic).toMatchObject({ + expect(ir.block.returns).toEqual([1]) + expect(ir.block.dynamic).toMatchObject({ id: 0, children: { 0: { id: 1 } }, }) - expect(ir.effect).toEqual([]) - expect((ir.operation[0] as ForIRNode).render.effect).lengthOf(1) + expect(ir.block.effect).toEqual([]) + expect((ir.block.operation[0] as ForIRNode).render.effect).lengthOf(1) }) test('multi effect', () => { diff --git a/packages/compiler-vapor/__tests__/transforms/vHtml.spec.ts b/packages/compiler-vapor/__tests__/transforms/vHtml.spec.ts index c24990214..456356c2c 100644 --- a/packages/compiler-vapor/__tests__/transforms/vHtml.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/vHtml.spec.ts @@ -23,8 +23,8 @@ describe('v-html', () => { expect(vaporHelpers).contains('setHtml') expect(helpers.size).toBe(0) - expect(ir.operation).toEqual([]) - expect(ir.effect).toMatchObject([ + expect(ir.block.operation).toEqual([]) + expect(ir.block.effect).toMatchObject([ { expressions: [ { @@ -65,8 +65,8 @@ describe('v-html', () => { // children should have been removed expect(ir.template).toEqual(['']) - expect(ir.operation).toEqual([]) - expect(ir.effect).toMatchObject([ + expect(ir.block.operation).toEqual([]) + expect(ir.block.effect).toMatchObject([ { expressions: [ { diff --git a/packages/compiler-vapor/__tests__/transforms/vIf.spec.ts b/packages/compiler-vapor/__tests__/transforms/vIf.spec.ts index 89fab97ee..b0875db09 100644 --- a/packages/compiler-vapor/__tests__/transforms/vIf.spec.ts +++ b/packages/compiler-vapor/__tests__/transforms/vIf.spec.ts @@ -32,7 +32,7 @@ describe('compiler: v-if', () => { expect(helpers.size).toBe(0) expect(ir.template).toEqual(['']) - expect(ir.operation).toMatchObject([ + expect(ir.block.operation).toMatchObject([ { type: IRNodeTypes.IF, id: 1, @@ -42,20 +42,20 @@ describe('compiler: v-if', () => { isStatic: false, }, positive: { - type: IRNodeTypes.BLOCK_FUNCTION, + type: IRNodeTypes.BLOCK, templateIndex: 0, }, }, ]) - expect(ir.returns).toEqual([1]) + expect(ir.block.returns).toEqual([1]) - expect(ir.dynamic).toMatchObject({ + expect(ir.block.dynamic).toMatchObject({ id: 0, children: { 0: { id: 1 } }, }) - expect(ir.effect).toEqual([]) - expect((ir.operation[0] as IfIRNode).positive.effect).lengthOf(1) + expect(ir.block.effect).toEqual([]) + expect((ir.block.operation[0] as IfIRNode).positive.effect).lengthOf(1) expect(code).matchSnapshot() }) @@ -68,8 +68,8 @@ describe('compiler: v-if', () => { expect(ir.template).toEqual(['hello']) - expect(ir.effect).toEqual([]) - expect((ir.operation[0] as IfIRNode).positive.effect).toMatchObject([ + expect(ir.block.effect).toEqual([]) + expect((ir.block.operation[0] as IfIRNode).positive.effect).toMatchObject([ { operations: [ { @@ -86,7 +86,7 @@ describe('compiler: v-if', () => { ], }, ]) - expect((ir.operation[0] as IfIRNode).positive.dynamic).toMatchObject({ + expect((ir.block.operation[0] as IfIRNode).positive.dynamic).toMatchObject({ id: 2, children: { 2: { id: 3 } }, }) @@ -98,7 +98,7 @@ describe('compiler: v-if', () => { ) expect(code).matchSnapshot() expect(ir.template).toEqual(['