From caccf92721ff96385435b10798f1cfef3de3315d Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 4 Oct 2019 08:38:53 -0400 Subject: [PATCH] test: fix vbind tests --- .../__tests__/transforms/vBind.spec.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/compiler-core/__tests__/transforms/vBind.spec.ts b/packages/compiler-core/__tests__/transforms/vBind.spec.ts index 0f6a1a1a..460a7632 100644 --- a/packages/compiler-core/__tests__/transforms/vBind.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vBind.spec.ts @@ -4,7 +4,8 @@ import { ElementNode, ObjectExpression, CompilerOptions, - ErrorCodes + ErrorCodes, + CallExpression } from '../../src' import { transformBind } from '../../src/transforms/vBind' import { transformElement } from '../../src/transforms/transformElement' @@ -32,7 +33,8 @@ function parseWithVBind( describe('compiler: transform v-bind', () => { test('basic', () => { const node = parseWithVBind(`
`) - const props = node.codegenNode!.arguments[1] as ObjectExpression + const props = (node.codegenNode as CallExpression) + .arguments[1] as ObjectExpression expect(props.properties[0]).toMatchObject({ key: { content: `id`, @@ -67,7 +69,8 @@ describe('compiler: transform v-bind', () => { test('dynamic arg', () => { const node = parseWithVBind(`
`) - const props = node.codegenNode!.arguments[1] as ObjectExpression + const props = (node.codegenNode as CallExpression) + .arguments[1] as ObjectExpression expect(props.properties[0]).toMatchObject({ key: { content: `id`, @@ -100,7 +103,8 @@ describe('compiler: transform v-bind', () => { test('.camel modifier', () => { const node = parseWithVBind(`
`) - const props = node.codegenNode!.arguments[1] as ObjectExpression + const props = (node.codegenNode as CallExpression) + .arguments[1] as ObjectExpression expect(props.properties[0]).toMatchObject({ key: { content: `fooBar`, @@ -115,7 +119,8 @@ describe('compiler: transform v-bind', () => { test('.camel modifier w/ dynamic arg', () => { const node = parseWithVBind(`
`) - const props = node.codegenNode!.arguments[1] as ObjectExpression + const props = (node.codegenNode as CallExpression) + .arguments[1] as ObjectExpression expect(props.properties[0]).toMatchObject({ key: { content: `_${CAMELIZE}(foo)`, @@ -132,7 +137,8 @@ describe('compiler: transform v-bind', () => { const node = parseWithVBind(`
`, { prefixIdentifiers: true }) - const props = node.codegenNode!.arguments[1] as ObjectExpression + const props = (node.codegenNode as CallExpression) + .arguments[1] as ObjectExpression expect(props.properties[0]).toMatchObject({ key: { children: [