From 4c69e3ce713cbb4255e0cf18dde4d0ab8a00dd9e Mon Sep 17 00:00:00 2001 From: Amour1688 Date: Sat, 6 Feb 2021 21:45:53 +0800 Subject: [PATCH] test: snap for KeepAlive --- .../test/__snapshots__/snapshot.test.ts.snap | 14 ++++++++++++++ packages/babel-plugin-jsx/test/snapshot.test.ts | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/packages/babel-plugin-jsx/test/__snapshots__/snapshot.test.ts.snap b/packages/babel-plugin-jsx/test/__snapshots__/snapshot.test.ts.snap index f708566..e4303fb 100644 --- a/packages/babel-plugin-jsx/test/__snapshots__/snapshot.test.ts.snap +++ b/packages/babel-plugin-jsx/test/__snapshots__/snapshot.test.ts.snap @@ -97,6 +97,20 @@ _withDirectives(_createVNode(\\"input\\", { }, null, 8, [\\"onUpdate:modelValue\\"]), [[_vModelText, test]]);" `; +exports[`named import specifier \`Keep Alive\`: named import specifier \`Keep Alive\` 1`] = ` +"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\"; +import { KeepAlive } from 'vue'; + +_createVNode(KeepAlive, null, [_createTextVNode(\\"123\\")]);" +`; + +exports[`namespace specifier \`Keep Alive\`: namespace specifier \`Keep Alive\` 1`] = ` +"import { createVNode as _createVNode, createTextVNode as _createTextVNode } from \\"vue\\"; +import * as Vue from 'vue'; + +_createVNode(Vue.KeepAlive, null, [_createTextVNode(\\"123\\")]);" +`; + exports[`override props multiple: multiple 1`] = ` "import { createVNode as _createVNode, resolveComponent as _resolveComponent } from \\"vue\\"; diff --git a/packages/babel-plugin-jsx/test/snapshot.test.ts b/packages/babel-plugin-jsx/test/snapshot.test.ts index e88d3db..d4c7ccc 100644 --- a/packages/babel-plugin-jsx/test/snapshot.test.ts +++ b/packages/babel-plugin-jsx/test/snapshot.test.ts @@ -147,6 +147,22 @@ const tests: Test[] = [ name: 'use "model" as the prop name', from: '', }, + { + name: 'named import specifier `Keep Alive`', + from: ` + import { KeepAlive } from 'vue'; + + 123 + `, + }, + { + name: 'namespace specifier `Keep Alive`', + from: ` + import * as Vue from 'vue'; + + 123 + `, + }, ]; tests.forEach((