2020-11-16 23:27:15 +00:00
|
|
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
|
|
|
|
|
|
exports[`CSS vars injection codegen <script> w/ default export 1`] = `
|
|
|
|
"const __default__ = { setup() {} }
|
|
|
|
import { useCssVars as _useCssVars } from 'vue'
|
|
|
|
const __injectCSSVars__ = () => {
|
|
|
|
_useCssVars(_ctx => ({
|
2020-11-17 18:03:47 +00:00
|
|
|
\\"xxxxxxxx-color\\": (_ctx.color)
|
|
|
|
}))}
|
2020-11-16 23:27:15 +00:00
|
|
|
const __setup__ = __default__.setup
|
|
|
|
__default__.setup = __setup__
|
|
|
|
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
|
|
|
|
: __injectCSSVars__
|
2020-11-25 15:30:29 +00:00
|
|
|
|
2020-11-16 23:27:15 +00:00
|
|
|
export default __default__"
|
|
|
|
`;
|
|
|
|
|
|
|
|
exports[`CSS vars injection codegen <script> w/ default export in strings/comments 1`] = `
|
|
|
|
"
|
|
|
|
// export default {}
|
|
|
|
const __default__ = {}
|
|
|
|
|
|
|
|
import { useCssVars as _useCssVars } from 'vue'
|
|
|
|
const __injectCSSVars__ = () => {
|
|
|
|
_useCssVars(_ctx => ({
|
2020-11-17 18:03:47 +00:00
|
|
|
\\"xxxxxxxx-color\\": (_ctx.color)
|
|
|
|
}))}
|
2020-11-16 23:27:15 +00:00
|
|
|
const __setup__ = __default__.setup
|
|
|
|
__default__.setup = __setup__
|
|
|
|
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
|
|
|
|
: __injectCSSVars__
|
2020-11-25 15:30:29 +00:00
|
|
|
|
2020-11-16 23:27:15 +00:00
|
|
|
export default __default__"
|
|
|
|
`;
|
|
|
|
|
|
|
|
exports[`CSS vars injection codegen <script> w/ no default export 1`] = `
|
|
|
|
"const a = 1
|
|
|
|
const __default__ = {}
|
|
|
|
import { useCssVars as _useCssVars } from 'vue'
|
|
|
|
const __injectCSSVars__ = () => {
|
|
|
|
_useCssVars(_ctx => ({
|
2020-11-17 18:03:47 +00:00
|
|
|
\\"xxxxxxxx-color\\": (_ctx.color)
|
|
|
|
}))}
|
2020-11-16 23:27:15 +00:00
|
|
|
const __setup__ = __default__.setup
|
|
|
|
__default__.setup = __setup__
|
|
|
|
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
|
|
|
|
: __injectCSSVars__
|
2020-11-25 15:30:29 +00:00
|
|
|
|
2020-11-16 23:27:15 +00:00
|
|
|
export default __default__"
|
|
|
|
`;
|
|
|
|
|
2021-07-26 15:19:56 +00:00
|
|
|
exports[`CSS vars injection codegen should ignore comments 1`] = `
|
2021-07-28 14:51:25 +00:00
|
|
|
"import { useCssVars as _useCssVars, unref as _unref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
2021-07-26 15:19:56 +00:00
|
|
|
setup(__props, { expose }) {
|
2021-11-15 03:22:53 +00:00
|
|
|
expose();
|
2021-07-28 14:51:25 +00:00
|
|
|
|
|
|
|
_useCssVars(_ctx => ({
|
|
|
|
\\"xxxxxxxx-width\\": (width)
|
|
|
|
}))
|
|
|
|
const color = 'red';const width = 100
|
|
|
|
return { color, width }
|
2021-07-26 15:19:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}"
|
|
|
|
`;
|
|
|
|
|
2020-11-16 23:27:15 +00:00
|
|
|
exports[`CSS vars injection codegen w/ <script setup> 1`] = `
|
|
|
|
"import { useCssVars as _useCssVars, unref as _unref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
2021-06-25 17:14:49 +00:00
|
|
|
setup(__props, { expose }) {
|
2021-11-15 03:22:53 +00:00
|
|
|
expose();
|
2020-11-16 23:27:15 +00:00
|
|
|
|
|
|
|
_useCssVars(_ctx => ({
|
2020-11-17 18:03:47 +00:00
|
|
|
\\"xxxxxxxx-color\\": (color)
|
|
|
|
}))
|
2020-11-16 23:27:15 +00:00
|
|
|
const color = 'red'
|
|
|
|
return { color }
|
|
|
|
}
|
|
|
|
|
|
|
|
}"
|
|
|
|
`;
|
|
|
|
|
2021-07-15 20:45:37 +00:00
|
|
|
exports[`CSS vars injection codegen w/ <script setup> using the same var multiple times 1`] = `
|
|
|
|
"import { useCssVars as _useCssVars, unref as _unref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
2021-07-15 20:57:30 +00:00
|
|
|
setup(__props, { expose }) {
|
2021-11-15 03:22:53 +00:00
|
|
|
expose();
|
2021-07-15 20:45:37 +00:00
|
|
|
|
|
|
|
_useCssVars(_ctx => ({
|
|
|
|
\\"xxxxxxxx-color\\": (color)
|
|
|
|
}))
|
|
|
|
|
|
|
|
const color = 'red'
|
|
|
|
|
|
|
|
return { color }
|
|
|
|
}
|
|
|
|
|
|
|
|
}"
|
|
|
|
`;
|
|
|
|
|
2020-11-16 23:27:15 +00:00
|
|
|
exports[`CSS vars injection generating correct code for nested paths 1`] = `
|
|
|
|
"const a = 1
|
|
|
|
const __default__ = {}
|
|
|
|
import { useCssVars as _useCssVars } from 'vue'
|
|
|
|
const __injectCSSVars__ = () => {
|
|
|
|
_useCssVars(_ctx => ({
|
2020-11-17 18:03:47 +00:00
|
|
|
\\"xxxxxxxx-color\\": (_ctx.color),
|
|
|
|
\\"xxxxxxxx-font_size\\": (_ctx.font.size)
|
|
|
|
}))}
|
2020-11-16 23:27:15 +00:00
|
|
|
const __setup__ = __default__.setup
|
|
|
|
__default__.setup = __setup__
|
|
|
|
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
|
|
|
|
: __injectCSSVars__
|
2020-11-25 15:30:29 +00:00
|
|
|
|
2020-11-16 23:27:15 +00:00
|
|
|
export default __default__"
|
|
|
|
`;
|
|
|
|
|
|
|
|
exports[`CSS vars injection w/ <script setup> binding analysis 1`] = `
|
|
|
|
"import { useCssVars as _useCssVars, unref as _unref } from 'vue'
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
2020-11-24 20:12:59 +00:00
|
|
|
foo: String
|
|
|
|
},
|
2021-06-25 17:14:49 +00:00
|
|
|
setup(__props, { expose }) {
|
2021-11-15 03:22:53 +00:00
|
|
|
expose();
|
2020-11-16 23:27:15 +00:00
|
|
|
|
|
|
|
_useCssVars(_ctx => ({
|
2020-11-17 18:03:47 +00:00
|
|
|
\\"xxxxxxxx-color\\": (color),
|
2020-11-19 03:34:55 +00:00
|
|
|
\\"xxxxxxxx-size\\": (size.value),
|
2020-11-17 18:03:47 +00:00
|
|
|
\\"xxxxxxxx-foo\\": (__props.foo)
|
|
|
|
}))
|
2020-11-16 23:27:15 +00:00
|
|
|
|
|
|
|
const color = 'red'
|
|
|
|
const size = ref('10px')
|
|
|
|
|
|
|
|
|
|
|
|
return { color, size, ref }
|
|
|
|
}
|
|
|
|
|
|
|
|
}"
|
|
|
|
`;
|
2021-05-28 22:40:35 +00:00
|
|
|
|
|
|
|
exports[`CSS vars injection w/ normal <script> binding analysis 1`] = `
|
|
|
|
"
|
|
|
|
const __default__ = {
|
|
|
|
setup() {
|
|
|
|
return {
|
|
|
|
size: ref('100px')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
import { useCssVars as _useCssVars } from 'vue'
|
|
|
|
const __injectCSSVars__ = () => {
|
|
|
|
_useCssVars(_ctx => ({
|
|
|
|
\\"xxxxxxxx-size\\": (_ctx.size)
|
|
|
|
}))}
|
|
|
|
const __setup__ = __default__.setup
|
|
|
|
__default__.setup = __setup__
|
|
|
|
? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }
|
|
|
|
: __injectCSSVars__
|
|
|
|
|
|
|
|
export default __default__"
|
|
|
|
`;
|