Skip to content

Commit 4e7ac84

Browse files
committed
test: cleanup
1 parent d041e1e commit 4e7ac84

File tree

4 files changed

+84
-335
lines changed

4 files changed

+84
-335
lines changed

__tests__/__snapshots__/index.test.ts.snap

+20-273
Original file line numberDiff line numberDiff line change
@@ -2378,264 +2378,11 @@ span {
23782378
`;
23792379

23802380
exports[`basic simple: js 1`] = `
2381-
"import { setDevtoolsHook, initCustomFormatter, computed, ref, watchEffect, openBlock, createBlock, resolveDynamicComponent, withCtx, toDisplayString, createCommentVNode, renderSlot, createVNode, withDirectives, withModifiers, vModelCheckbox, reactive, onMounted, resolveComponent, createTextVNode, createApp } from '@vue/runtime-dom';
2382-
import { getGlobalThis } from '@vue/shared';
2383-
2384-
function initDev() {
2385-
const target = getGlobalThis();
2386-
target.__VUE__ = true;
2387-
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__);
2388-
{
2389-
console.info(\`You are running a development build of Vue.\\\\n\` +
2390-
\`Make sure to use the production build (*.prod.js) when deploying for production.\`);
2391-
initCustomFormatter();
2392-
}
2393-
}
2394-
2395-
// This entry exports the runtime only, and is built as
2396-
(process.env.NODE_ENV !== 'production') && initDev();
2381+
"import { reactive, computed, onMounted, watchEffect, resolveComponent, openBlock, createBlock, createVNode, withCtx, createTextVNode, toDisplayString, createApp } from 'vue';
2382+
import { VField, VButton, VSwitch } from '@pathscale/vue3-ui';
23972383
23982384
var script = {
2399-
name: 'VButton',
2400-
props: {
2401-
type: {
2402-
type: String,
2403-
default: 'button'
2404-
},
2405-
size: String,
2406-
label: String,
2407-
rounded: Boolean,
2408-
loading: Boolean,
2409-
outlined: Boolean,
2410-
expanded: Boolean,
2411-
inverted: Boolean,
2412-
focused: Boolean,
2413-
active: Boolean,
2414-
hovered: Boolean,
2415-
selected: Boolean,
2416-
nativeType: {
2417-
type: String,
2418-
default: 'button'
2419-
},
2420-
tag: {
2421-
type: String,
2422-
default: 'button'
2423-
},
2424-
light: Boolean
2425-
},
2426-
setup(props, { attrs }) {
2427-
const computedTag = computed(() => attrs.disabled ? 'button' : props.tag);
2428-
return { computedTag }
2429-
}
2430-
};
2431-
2432-
const _hoisted_1 = { key: 0 };
2433-
2434-
function render(_ctx, _cache, $props, $setup, $data, $options) {
2435-
return (openBlock(), createBlock(resolveDynamicComponent($setup.computedTag), {
2436-
class: [\\"button\\", [
2437-
$props.size,
2438-
$props.type,
2439-
{
2440-
'is-rounded': $props.rounded,
2441-
'is-loading': $props.loading,
2442-
'is-outlined': $props.outlined,
2443-
'is-fullwidth': $props.expanded,
2444-
'is-inverted': $props.inverted,
2445-
'is-focused': $props.focused,
2446-
'is-active': $props.active,
2447-
'is-hovered': $props.hovered,
2448-
'is-selected': $props.selected,
2449-
'is-light': $props.light,
2450-
}
2451-
]],
2452-
type: $props.nativeType
2453-
}, {
2454-
default: withCtx(() => [
2455-
($props.label)
2456-
? (openBlock(), createBlock(\\"span\\", _hoisted_1, toDisplayString($props.label), 1))
2457-
: createCommentVNode(\\"\\", true),
2458-
renderSlot(_ctx.$slots, \\"default\\")
2459-
]),
2460-
_: 3
2461-
}, 8, [\\"type\\", \\"class\\"]))
2462-
}
2463-
2464-
script.render = render;
2465-
2466-
var script$3 = {
2467-
name: 'VField',
2468-
props: {
2469-
type: String,
2470-
label: String,
2471-
labelFor: String,
2472-
message: String,
2473-
grouped: Boolean,
2474-
groupMultiline: Boolean,
2475-
position: String,
2476-
expanded: Boolean,
2477-
horizontal: Boolean,
2478-
addons: Boolean,
2479-
size: String,
2480-
},
2481-
setup(props) {
2482-
const hasHorizontalLabel = computed(() => props.horizontal && props.label);
2483-
return { hasHorizontalLabel }
2484-
}
2485-
};
2486-
2487-
const _hoisted_1$2 = {
2488-
key: 2,
2489-
class: \\"field-body\\"
2490-
};
2491-
2492-
function render$3(_ctx, _cache, $props, $setup, $data, $options) {
2493-
return (openBlock(), createBlock(\\"div\\", {
2494-
class: [\\"field\\", [
2495-
$props.position, {
2496-
'is-expanded': $props.expanded,
2497-
'is-horizontal': $props.horizontal,
2498-
'is-grouped': $props.grouped,
2499-
'is-grouped-multiline': $props.groupMultiline,
2500-
'has-addons': $props.addons
2501-
}]]
2502-
}, [
2503-
($setup.hasHorizontalLabel)
2504-
? (openBlock(), createBlock(\\"div\\", {
2505-
key: 0,
2506-
class: [\\"field-label\\", $props.size]
2507-
}, [
2508-
createVNode(\\"label\\", {
2509-
class: \\"label\\",
2510-
for: $props.labelFor
2511-
}, toDisplayString($props.label), 9, [\\"for\\"])
2512-
], 2))
2513-
: ($props.label)
2514-
? (openBlock(), createBlock(\\"label\\", {
2515-
key: 1,
2516-
class: \\"label\\",
2517-
for: $props.labelFor
2518-
}, toDisplayString($props.label), 9, [\\"for\\"]))
2519-
: createCommentVNode(\\"\\", true),
2520-
($props.horizontal)
2521-
? (openBlock(), createBlock(\\"div\\", _hoisted_1$2, [
2522-
createVNode(\\"div\\", {
2523-
class: [\\"field\\", {'is-grouped': $props.grouped}]
2524-
}, [
2525-
renderSlot(_ctx.$slots, \\"default\\")
2526-
], 2)
2527-
]))
2528-
: renderSlot(_ctx.$slots, \\"default\\", { key: 3 }),
2529-
($props.message)
2530-
? (openBlock(), createBlock(\\"p\\", {
2531-
key: 4,
2532-
class: [\\"help\\", $props.type]
2533-
}, toDisplayString($props.message), 3))
2534-
: createCommentVNode(\\"\\", true)
2535-
], 2))
2536-
}
2537-
2538-
script$3.render = render$3;
2539-
2540-
function checkBenchieSupport() {
2541-
const isProduction = process.env.NODE_ENV === 'production';
2542-
if (!isProduction) return false
2543-
return (
2544-
typeof t !== 'undefined' &&
2545-
typeof $__CDN !== 'undefined' &&
2546-
typeof t === 'function' &&
2547-
typeof $__CDN === 'string'
2548-
)
2549-
}
2550-
2551-
const hasBenchieSupport$1 = checkBenchieSupport();
2552-
2553-
var script$c = {
2554-
name: 'VSwitch',
2555-
props: {
2556-
modelValue: {
2557-
type: [String, Number, Boolean, Function, Object, Array, Date],
2558-
},
2559-
nativeValue: {
2560-
type: [String, Number, Boolean, Function, Object, Array, Date],
2561-
},
2562-
disabled: {
2563-
type: Boolean,
2564-
default: null
2565-
},
2566-
type: String,
2567-
passiveType: String,
2568-
name: String,
2569-
required: Boolean,
2570-
size: String,
2571-
trueValue: {
2572-
type: [String, Number, Boolean, Function, Object, Array, Date],
2573-
default: true
2574-
},
2575-
falseValue: {
2576-
type: [String, Number, Boolean, Function, Object, Array, Date],
2577-
default: false
2578-
},
2579-
rounded: {
2580-
type: Boolean,
2581-
default: true
2582-
},
2583-
outlined: Boolean
2584-
},
2585-
emits: ['update:modelValue'],
2586-
setup(props, { emit }) {
2587-
const value = ref(props.modelValue);
2588-
const passiveClass = computed(() => props.passiveType && \`\${props.passiveType}-passive\`);
2589-
watchEffect(() => {
2590-
value.value = props.modelValue;
2591-
});
2592-
watchEffect(() => {
2593-
emit('update:modelValue', value.value);
2594-
});
2595-
return { value, passiveClass }
2596-
}
2597-
};
2598-
2599-
const _hoisted_1$a = { class: \\"control-label\\" };
2600-
2601-
function render$c(_ctx, _cache, $props, $setup, $data, $options) {
2602-
return (openBlock(), createBlock(\\"label\\", {
2603-
class: [\\"switch\\", [
2604-
$props.size,
2605-
{
2606-
'is-disabled': $props.disabled,
2607-
'is-rounded': $props.rounded,
2608-
'is-outlined': $props.outlined,
2609-
}
2610-
]],
2611-
disabled: $props.disabled
2612-
}, [
2613-
withDirectives(createVNode(\\"input\\", {
2614-
\\"onUpdate:modelValue\\": _cache[1] || (_cache[1] = $event => ($setup.value = $event)),
2615-
type: \\"checkbox\\",
2616-
onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, [\\"stop\\"])),
2617-
disabled: $props.disabled,
2618-
name: $props.name,
2619-
required: $props.required,
2620-
value: $props.nativeValue,
2621-
\\"true-value\\": $props.trueValue,
2622-
\\"false-value\\": $props.falseValue
2623-
}, null, 8, [\\"disabled\\", \\"name\\", \\"required\\", \\"value\\", \\"true-value\\", \\"false-value\\"]), [
2624-
[vModelCheckbox, $setup.value]
2625-
]),
2626-
createVNode(\\"span\\", {
2627-
class: [\\"check\\", [$setup.passiveClass, $props.type]]
2628-
}, null, 2),
2629-
createVNode(\\"span\\", _hoisted_1$a, [
2630-
renderSlot(_ctx.$slots, \\"default\\")
2631-
])
2632-
], 10, [\\"disabled\\"]))
2633-
}
2634-
2635-
script$c.render = render$c;
2636-
2637-
var script$1 = {
2638-
components: { VField: script$3, VButton: script, VSwitch: script$c },
2385+
components: { VField, VButton, VSwitch },
26392386
emits: [\\"login\\"],
26402387
setup(props, { emit }) {
26412388
const state = reactive({ email: \\"\\", password: \\"\\", remember: false });
@@ -2660,10 +2407,10 @@ var script$1 = {
26602407
},
26612408
};
26622409
2663-
const _hoisted_1$1 = /*#__PURE__*/createTextVNode(\\" Remember me \\");
2410+
const _hoisted_1 = /*#__PURE__*/createTextVNode(\\" Remember me \\");
26642411
const _hoisted_2 = /*#__PURE__*/createTextVNode(\\"Login\\");
26652412
2666-
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
2413+
function render(_ctx, _cache, $props, $setup, $data, $options) {
26672414
const _component_VSwitch = resolveComponent(\\"VSwitch\\");
26682415
const _component_v_field = resolveComponent(\\"v-field\\");
26692416
const _component_VButton = resolveComponent(\\"VButton\\");
@@ -2679,12 +2426,12 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
26792426
\\"onUpdate:modelValue\\": _cache[1] || (_cache[1] = $event => ($setup.state.remember = $event))
26802427
}, {
26812428
default: withCtx(() => [
2682-
_hoisted_1$1
2429+
_hoisted_1
26832430
]),
2684-
_: 1
2431+
_: 1 /* STABLE */
26852432
}, 8 /* PROPS */, [\\"modelValue\\"])
26862433
]),
2687-
_: 1
2434+
_: 1 /* STABLE */
26882435
}),
26892436
createVNode(_component_VField, null, {
26902437
default: withCtx(() => [
@@ -2699,38 +2446,38 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
26992446
default: withCtx(() => [
27002447
_hoisted_2
27012448
]),
2702-
_: 1
2449+
_: 1 /* STABLE */
27032450
}, 8 /* PROPS */, [\\"onClick\\", \\"disabled\\"])
27042451
]),
2705-
_: 1
2452+
_: 1 /* STABLE */
27062453
})
27072454
]))
27082455
}
27092456
2710-
script$1.render = render$1;
2711-
script$1.__file = \\"__tests__/fixtures/simple/Dummy.vue\\";
2457+
script.render = render;
2458+
script.__file = \\"__tests__/fixtures/simple/Dummy.vue\\";
27122459
2713-
var script$2 = {
2714-
components: { Dummy: script$1 },
2460+
var script$1 = {
2461+
components: { Dummy: script },
27152462
props: { name: { type: String, default: \\"John\\" } },
27162463
};
27172464
2718-
const _hoisted_1$3 = /*#__PURE__*/createTextVNode(\\" Hello \\");
2465+
const _hoisted_1$1 = /*#__PURE__*/createTextVNode(\\" Hello \\");
27192466
const _hoisted_2$1 = { class: \\"name\\" };
27202467
2721-
function render$2(_ctx, _cache, $props, $setup, $data, $options) {
2468+
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
27222469
const _component_Dummy = resolveComponent(\\"Dummy\\");
27232470
27242471
return (openBlock(), createBlock(\\"h1\\", null, [
2725-
_hoisted_1$3,
2472+
_hoisted_1$1,
27262473
createVNode(\\"span\\", _hoisted_2$1, toDisplayString($props.name), 1 /* TEXT */),
27272474
createVNode(_component_Dummy)
27282475
]))
27292476
}
27302477
2731-
script$2.render = render$2;
2732-
script$2.__file = \\"__tests__/fixtures/simple/Test.vue\\";
2478+
script$1.render = render$1;
2479+
script$1.__file = \\"__tests__/fixtures/simple/Test.vue\\";
27332480
2734-
createApp(script$2).mount(document.body);
2481+
createApp(script$1).mount(document.body);
27352482
"
27362483
`;

__tests__/helpers/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import json from "@rollup/plugin-json";
1010
import resolve from "@rollup/plugin-node-resolve";
1111
import vue from "rollup-plugin-vue";
1212
import styles from "rollup-plugin-styles";
13+
import externals from "rollup-plugin-node-externals";
1314

1415
export interface WriteData {
1516
input: string | string[];
@@ -48,6 +49,7 @@ export async function write(data: WriteData): Promise<WriteResult> {
4849
...data.inputOpts,
4950
input,
5051
plugins: [
52+
externals({ deps: true }),
5153
json(),
5254
resolve({
5355
preferBuiltins: true,

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@commitlint/prompt-cli": "^11.0.0",
6161
"@pathscale/bulma-extensions-css-var": "^0.0.41",
6262
"@pathscale/bulma-pull-2981-css-var-only": "^0.9.6",
63-
"@pathscale/vue3-ui": "^0.8.124",
63+
"@pathscale/vue3-ui": "^0.8.125",
6464
"@rollup/plugin-babel": "^5.2.2",
6565
"@rollup/plugin-commonjs": "^17.0.0",
6666
"@rollup/plugin-json": "^4.1.0",
@@ -76,7 +76,7 @@
7676
"@types/resolve": "^1.17.1",
7777
"@typescript-eslint/eslint-plugin": "^4.11.0",
7878
"@typescript-eslint/parser": "^4.11.0",
79-
"@vue/compiler-sfc": "3.0.1",
79+
"@vue/compiler-sfc": "3.0.4",
8080
"builtin-modules": "^3.2.0",
8181
"eslint": "^7.16.0",
8282
"eslint-config-prettier": "^7.1.0",
@@ -99,7 +99,7 @@
9999
"shx": "^0.3.3",
100100
"ts-jest": "^26.4.4",
101101
"typescript": "^4.1.3",
102-
"vue": "3.0.1"
102+
"vue": "3.0.4"
103103
},
104104
"peerDependencies": {
105105
"rollup": "^2.2.0",

0 commit comments

Comments
 (0)