Skip to content

Commit a87ada8

Browse files
committed
test: add
1 parent c6dc7b7 commit a87ada8

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

packages/compiler-sfc/__tests__/__snapshots__/compileScript.spec.ts.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,20 @@ return { ref }
975975
}"
976976
`;
977977

978+
exports[`SFC compile <script setup> imports shuold support module string names syntax 1`] = `
979+
"import { "😏" as foo } from './foo'
980+
981+
export default {
982+
setup(__props, { expose }) {
983+
expose();
984+
985+
986+
return { get foo() { return foo } }
987+
}
988+
989+
}"
990+
`;
991+
978992
exports[`SFC compile <script setup> inlineTemplate mode avoid unref() when necessary 1`] = `
979993
"import { unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, createElementVNode as _createElementVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue"
980994

packages/compiler-sfc/__tests__/compileScript.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,21 @@ defineExpose({ foo: 123 })
409409
})
410410
})
411411
})
412+
413+
test('shuold support module string names syntax', () => {
414+
const { content, bindings } = compile(`
415+
<script>
416+
import { "😏" as foo } from './foo'
417+
</script>
418+
<script setup>
419+
import { "😏" as foo } from './foo'
420+
</script>
421+
`)
422+
assertCode(content)
423+
expect(bindings).toStrictEqual({
424+
foo: BindingTypes.SETUP_MAYBE_REF
425+
})
426+
})
412427
})
413428

414429
// in dev mode, declared bindings are returned as an object from setup()

0 commit comments

Comments
 (0)