Skip to content

Commit 4723264

Browse files
committed
chore: fix test
1 parent 2df088a commit 4723264

File tree

2 files changed

+3
-154
lines changed

2 files changed

+3
-154
lines changed

packages/macros/tests/__snapshots__/fixtures.spec.ts.snap

Lines changed: 3 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -54,145 +54,6 @@ let __temp, __restore
5454

5555
exports[`fixtures > ./fixtures/define-expose.tsx 1`] = `
5656
"
57-
import { getCurrentInstance as __MACROS_getCurrentInstance } from "vue";export function Comp(__MACROS_props) {
58-
;(__MACROS_getCurrentInstance().exposed = {
59-
foo: 1,
60-
})
61-
return <div />
62-
}
63-
64-
export const Comp1 = function (props: any) {
65-
;(__MACROS_getCurrentInstance().exposed = {
66-
foo: props.foo,
67-
})
68-
return <div />
69-
}
70-
71-
export const Comp2 = ({ foo, ...__MACROS_props }: any) => {
72-
;(__MACROS_getCurrentInstance().exposed = {
73-
foo,
74-
})
75-
return <div />
76-
}
77-
"
78-
`;
79-
80-
exports[`fixtures > ./fixtures/define-model.tsx 1`] = `
81-
"
82-
import { useModel as __MACROS_useModel } from "vue-jsx-vapor/macros/use-model";export const Comp = ({ bar, ...__MACROS_props }: { bar: string }) => {
83-
const foo = __MACROS_useModel<string, 'm1' | 'm2'>(__MACROS_props, 'foo', { default: bar })
84-
return <div>{foo.value}</div>
85-
}
86-
87-
export default function (__MACROS_props) {
88-
const modelValue = $(__MACROS_useModel<string>(__MACROS_props, 'modelValue',)!)
89-
return (
90-
<Comp v-model:foo_m1={modelValue} bar="bar">
91-
{modelValue}
92-
</Comp>
93-
)
94-
}
95-
"
96-
`;
97-
98-
exports[`fixtures > ./fixtures/define-slots.tsx 1`] = `
99-
"
100-
import { useSlots as __MACROS_useSlots } from "vue";export const Comp = (__MACROS_props) => {
101-
const slots = Object.assign<{
102-
default: () => any
103-
}>({}, __MACROS_useSlots())
104-
return <div>{slots.default?.()}</div>
105-
}
106-
107-
export default function (__MACROS_props) {
108-
const slots = Object.assign({
109-
default: () => <div>default</div>,
110-
},__MACROS_useSlots())
111-
return <div>{slots.default?.()}</div>
112-
}
113-
"
114-
`;
115-
116-
exports[`fixtures > ./fixtures/define-style.tsx 1`] = `
117-
"import "vue-jsx-vapor/macros/define-style/0?scopeId=4e9d5cd0&scoped=true&lang.css";import style1 from "vue-jsx-vapor/macros/define-style/1?scopeId=426a859d&scoped=true&lang.module.scss";import "vue-jsx-vapor/macros/define-style/2?scopeId=63a7910c&scoped=false&lang.scss";import { defineComponent, ref } from 'vue'
118-
119-
export const Comp = (__MACROS_props) => {
120-
const color = ref('red')
121-
122-
return <div {...{style:{'--4e9d5cd0-color-value': color.value}}} data-v-4e9d5cd0="" class="foo">foo</div>
123-
}
124-
125-
export default defineComponent((__MACROS_props) => {
126-
const color = ref('red')
127-
const styles = style1
128-
return () => (
129-
<>
130-
<div {...{style:{'--426a859d-color-value': color.value}}} data-v-426a859d="" class={styles.bar}>foo</div>
131-
<div {...{style:{'--426a859d-color-value': color.value}}} data-v-426a859d="" class="bar">
132-
<span data-v-426a859d="">bar</span>
133-
</div>
134-
</>
135-
)
136-
})
137-
138-
139-
"
140-
`;
141-
142-
exports[`vue/vapor fixtures > ./fixtures/define-component.tsx 1`] = `
143-
"
144-
import { createPropsDefaultProxy as __MACROS_createPropsDefaultProxy } from "vue-jsx-vapor/macros/with-defaults";
145-
import { useAttrs as __MACROS_useAttrs } from "vue";
146-
import { useModel as __MACROS_useModel } from "vue-jsx-vapor/macros/use-model";
147-
import { withAsyncContext as __MACROS_withAsyncContext } from "vue";import { defineComponent, nextTick } from 'vue'
148-
149-
const Comp = defineComponent(
150-
(__MACROS_props) => {
151-
const __MACROS_default_props = __MACROS_createPropsDefaultProxy(__MACROS_props, {'.bar': 'bar'!});const attrs = __MACROS_useAttrs();
152-
__MACROS_useModel(__MACROS_props, 'modelValue',)
153-
const foo = $(
154-
__MACROS_useModel(__MACROS_props, 'foo', {
155-
validator: (value) => {
156-
return value === 'foo'
157-
},
158-
type: String,
159-
})!,
160-
)
161-
return <div>{[foo, __MACROS_default_props.bar, attrs.baz]}</div>
162-
},
163-
{props: { 'bar': { required: true }, 'modelValue': null, 'onUpdate:modelValue': null, 'modelModifiers': null, 'foo': { required: true, validator: (value) => {
164-
return value === 'foo'
165-
}, type: String }, 'onUpdate:foo': null, 'fooModifiers': null },inheritAttrs: false, name: 'Comp' },
166-
)
167-
168-
const Comp1 = defineComponent((props: { bar: 'bar'; 'onUpdate:bar': any }) => {
169-
const foo = __MACROS_useModel(props, 'foo')
170-
return <div>{[foo.value, props['bar'], props['onUpdate:bar']]}</div>
171-
}, { props: { 'bar': null, 'onUpdate:bar': null, 'foo': null, 'onUpdate:foo': null, 'fooModifiers': null } })
172-
173-
const Comp2 = defineComponent(async (__MACROS_props) => {
174-
let __temp, __restore
175-
176-
;(
177-
([__temp,__restore] = __MACROS_withAsyncContext(() => nextTick())),
178-
await __temp,
179-
__restore()
180-
)
181-
let foo = (
182-
([__temp,__restore] = __MACROS_withAsyncContext(() => new Promise((resolve) => {
183-
setTimeout(() => resolve('foo'), 1000)
184-
}))),
185-
__temp = await __temp,
186-
__restore(),
187-
__temp
188-
)
189-
return () => <div>{foo}</div>
190-
})
191-
"
192-
`;
193-
194-
exports[`vue/vapor fixtures > ./fixtures/define-expose.tsx 1`] = `
195-
"
19657
import { currentInstance as __MACROS_currentInstance } from "vue";export function Comp(__MACROS_props) {
19758
;(__MACROS_currentInstance.exposed = {
19859
foo: 1,
@@ -216,7 +77,7 @@ export const Comp2 = ({ foo, ...__MACROS_props }: any) => {
21677
"
21778
`;
21879

219-
exports[`vue/vapor fixtures > ./fixtures/define-model.tsx 1`] = `
80+
exports[`fixtures > ./fixtures/define-model.tsx 1`] = `
22081
"
22182
import { useModel as __MACROS_useModel } from "vue-jsx-vapor/macros/use-model";export const Comp = ({ bar, ...__MACROS_props }: { bar: string }) => {
22283
const foo = __MACROS_useModel<string, 'm1' | 'm2'>(__MACROS_props, 'foo', { default: bar })
@@ -234,7 +95,7 @@ export default function (__MACROS_props) {
23495
"
23596
`;
23697

237-
exports[`vue/vapor fixtures > ./fixtures/define-slots.tsx 1`] = `
98+
exports[`fixtures > ./fixtures/define-slots.tsx 1`] = `
23899
"
239100
import { useSlots as __MACROS_useSlots } from "vue";export const Comp = (__MACROS_props) => {
240101
const slots = Object.assign<{
@@ -252,7 +113,7 @@ export default function (__MACROS_props) {
252113
"
253114
`;
254115
255-
exports[`vue/vapor fixtures > ./fixtures/define-style.tsx 1`] = `
116+
exports[`fixtures > ./fixtures/define-style.tsx 1`] = `
256117
"import "vue-jsx-vapor/macros/define-style/0?scopeId=4e9d5cd0&scoped=true&lang.css";import style1 from "vue-jsx-vapor/macros/define-style/1?scopeId=426a859d&scoped=true&lang.module.scss";import "vue-jsx-vapor/macros/define-style/2?scopeId=63a7910c&scoped=false&lang.scss";import { defineComponent, ref } from 'vue'
257118
258119
export const Comp = (__MACROS_props) => {

packages/macros/tests/fixtures.spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,3 @@ describe('fixtures', async () => {
3737
})?.code,
3838
)
3939
})
40-
41-
describe('vue/vapor fixtures', async () => {
42-
await testFixtures(
43-
globs,
44-
(args, id, code) =>
45-
transformJsxMacros(code, id, new Map(), {
46-
include: ['*.tsx'],
47-
version: 3.6,
48-
...options,
49-
})?.code,
50-
)
51-
})

0 commit comments

Comments
 (0)