@@ -1540,38 +1540,43 @@ const emit = defineEmits(['a', 'b'])
15401540 assertCode ( content )
15411541 } )
15421542
1543- test ( 'defineSlots' , ( ) => {
1544- const { content } = compile ( `
1545- <script setup lang="ts">
1546- const slots = defineSlots<{
1547- default: { msg: string }
1548- }>()
1549- </script>
1550- ` )
1551- assertCode ( content )
1552- expect ( content ) . toMatch ( `const slots = _useSlots()` )
1553- } )
1543+ describe ( 'defineSlots()' , ( ) => {
1544+ test ( 'basic usage' , ( ) => {
1545+ const { content } = compile ( `
1546+ <script setup lang="ts">
1547+ const slots = defineSlots<{
1548+ default: { msg: string }
1549+ }>()
1550+ </script>
1551+ ` )
1552+ assertCode ( content )
1553+ expect ( content ) . toMatch ( `const slots = _useSlots()` )
1554+ expect ( content ) . not . toMatch ( 'defineSlots' )
1555+ } )
15541556
1555- test ( 'defineSlots w/o return value' , ( ) => {
1556- const { content } = compile ( `
1557- <script setup lang="ts">
1558- defineSlots<{
1559- default: { msg: string }
1560- }>()
1561- </script>
1562- ` )
1563- assertCode ( content )
1564- expect ( content ) . not . toMatch ( `_useSlots` )
1565- } )
1557+ test ( 'w/o return value' , ( ) => {
1558+ const { content } = compile ( `
1559+ <script setup lang="ts">
1560+ defineSlots<{
1561+ default: { msg: string }
1562+ }>()
1563+ </script>
1564+ ` )
1565+ assertCode ( content )
1566+ expect ( content ) . not . toMatch ( 'defineSlots' )
1567+ expect ( content ) . not . toMatch ( `_useSlots` )
1568+ } )
15661569
1567- test ( 'defineSlots w/o generic params' , ( ) => {
1568- const { content } = compile ( `
1569- <script setup>
1570- const slots = defineSlots()
1571- </script>
1572- ` )
1573- assertCode ( content )
1574- expect ( content ) . toMatch ( `const slots = _useSlots()` )
1570+ test ( 'w/o generic params' , ( ) => {
1571+ const { content } = compile ( `
1572+ <script setup>
1573+ const slots = defineSlots()
1574+ </script>
1575+ ` )
1576+ assertCode ( content )
1577+ expect ( content ) . toMatch ( `const slots = _useSlots()` )
1578+ expect ( content ) . not . toMatch ( 'defineSlots' )
1579+ } )
15751580 } )
15761581
15771582 test ( 'runtime Enum' , ( ) => {
0 commit comments