Skip to content

Commit

Permalink
test: merge tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 13, 2022
1 parent c113fa0 commit 8dea0dd
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,17 @@ describe('sfc props transform', () => {
})
})

test('aliasing w/ StringLiteral', () => {
// #5425
test('non-identifier prop names', () => {
const { content, bindings } = compile(`
<script setup>
const { 'foo.bar': fooBar } = defineProps({ 'foo.bar': Function })
let x = fooBar
</script>
<template>{{ fooBar }}</template>
`)
expect(content).toMatch(`x = (__props["foo.bar"])`)
expect(content).toMatch(`toDisplayString(__props["foo.bar"])`)
assertCode(content)
expect(bindings).toStrictEqual({
x: BindingTypes.SETUP_LET,
Expand Down Expand Up @@ -181,20 +184,6 @@ describe('sfc props transform', () => {
assertCode(content)
})

// #5425
test('non-identifier prop names', () => {
const { content } = compile(`
<script setup>
const { 'onUpdate:foo': foo } = defineProps(['onUpdate:foo'])
console.log(foo)
</script>
<template>{{ foo }}</template>
`)
expect(content).toMatch(`console.log(__props["onUpdate:foo"])`)
expect(content).toMatch(`toDisplayString(__props["onUpdate:foo"])`)
assertCode(content)
})

describe('errors', () => {
test('should error on deep destructure', () => {
expect(() =>
Expand Down

0 comments on commit 8dea0dd

Please sign in to comment.