diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/astro/src/internal/__astro_component.ts | 12 | ||||
-rw-r--r-- | packages/astro/src/internal/__astro_slot.ts | 6 | ||||
-rw-r--r-- | packages/astro/test/astro-slots.test.js | 2 |
3 files changed, 9 insertions, 11 deletions
diff --git a/packages/astro/src/internal/__astro_component.ts b/packages/astro/src/internal/__astro_component.ts index ff1d2ff54..6738600e3 100644 --- a/packages/astro/src/internal/__astro_component.ts +++ b/packages/astro/src/internal/__astro_component.ts @@ -113,9 +113,9 @@ const getComponentName = (Component: any, componentProps: any) => { } }; -const prepareSlottedChildren = (children: string|Record<any, any>[]) => { +const prepareSlottedChildren = (children: string | Record<any, any>[]) => { const $slots: Record<string, string> = { - default: '' + default: '', }; for (const child of children) { if (typeof child === 'string') { @@ -127,9 +127,9 @@ const prepareSlottedChildren = (children: string|Record<any, any>[]) => { } return { $slots }; -} +}; -const removeSlottedChildren = (_children: string|Record<any, any>[]) => { +const removeSlottedChildren = (_children: string | Record<any, any>[]) => { let children = ''; for (const child of _children) { if (typeof child === 'string') { @@ -140,7 +140,7 @@ const removeSlottedChildren = (_children: string|Record<any, any>[]) => { } return children; -} +}; /** The main wrapper for any components in Astro files */ export function __astro_component(Component: any, metadata: AstroComponentMetadata = {} as any) { @@ -190,4 +190,4 @@ export function __astro_component(Component: any, metadata: AstroComponentMetada const astroRoot = `<astro-root uid="${astroId}">${html}</astro-root>`; return [astroRoot, script].join('\n'); }; -}; +} diff --git a/packages/astro/src/internal/__astro_slot.ts b/packages/astro/src/internal/__astro_slot.ts index c049e82bc..a719fa297 100644 --- a/packages/astro/src/internal/__astro_slot.ts +++ b/packages/astro/src/internal/__astro_slot.ts @@ -1,9 +1,9 @@ /** */ -export function __astro_slot_content({ name }: { name: string}, ...children: any[]) { - return { '$slot': name, children }; +export function __astro_slot_content({ name }: { name: string }, ...children: any[]) { + return { $slot: name, children }; } -export const __astro_slot = ({ name = 'default' }: { name: string}, _children: any, ...fallback: string[]) => { +export const __astro_slot = ({ name = 'default' }: { name: string }, _children: any, ...fallback: string[]) => { if (name === 'default' && typeof _children === 'string') { return _children ? _children : fallback; } diff --git a/packages/astro/test/astro-slots.test.js b/packages/astro/test/astro-slots.test.js index 343244910..69944a437 100644 --- a/packages/astro/test/astro-slots.test.js +++ b/packages/astro/test/astro-slots.test.js @@ -63,7 +63,6 @@ Slots('Slots work with multiple elements', async ({ runtime }) => { assert.equal($('#a').text(), 'ABC'); }); - Slots('Slots work on Components', async ({ runtime }) => { const result = await runtime.load('/component'); if (result.error) throw new Error(result.error); @@ -75,5 +74,4 @@ Slots('Slots work on Components', async ({ runtime }) => { assert.equal($('#default').children('astro-component').length, 1, 'Slotted component into default slot'); }); - Slots.run(); |