From 92021fd316c0b4c0550e3c108dac95080a45ef83 Mon Sep 17 00:00:00 2001 From: rigor789 Date: Wed, 1 Apr 2020 19:16:10 +0200 Subject: [PATCH] feat(compiler): transform vShow --- .../__tests__/transforms/vShow.spec.ts | 43 +++++++++++++++++++ packages/compiler/src/index.ts | 6 +-- packages/compiler/src/transforms/vShow.ts | 17 ++++++++ 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 packages/compiler/__tests__/transforms/vShow.spec.ts create mode 100644 packages/compiler/src/transforms/vShow.ts diff --git a/packages/compiler/__tests__/transforms/vShow.spec.ts b/packages/compiler/__tests__/transforms/vShow.spec.ts new file mode 100644 index 00000000..6b7ba576 --- /dev/null +++ b/packages/compiler/__tests__/transforms/vShow.spec.ts @@ -0,0 +1,43 @@ +// todo: uncomment when vue-next#907 is released +test.todo('uncomment when vue-next#907 is released') +// import { +// baseParse as parse, +// transform, +// generate, +// CompilerOptions, +// transformElement +// } from '@vue/compiler-core' +// import { transformShow } from '../../src/transforms/vShow' +// import { DOMErrorCodes } from '../../src/errors' +// +// function transformWithShow(template: string, options: CompilerOptions = {}) { +// const ast = parse(template) +// transform(ast, { +// nodeTransforms: [transformElement], +// directiveTransforms: { +// show: transformShow +// }, +// ...options +// }) +// return ast +// } +// +// describe('compiler: v-show transform', () => { +// test('simple expression', () => { +// const ast = transformWithShow(`