blob: 119087a368db9c876d3d2c7ef5d8b2b33463d9f5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import { experimental_AstroContainer as AstroContainer } from 'astro/container';
import { expect, test } from 'vitest';
import Card from '../src/components/Card.astro';
import CounterLight from '../src/components/CounterLight.astro';
test('Card with slots', async () => {
const container = await AstroContainer.create();
const result = await container.renderToString(Card, {
slots: {
default: 'Card content',
},
});
expect(result).toContain('This is a card');
expect(result).toContain('Card content');
});
test('Card with nested CounterLight', async () => {
const container = await AstroContainer.create();
const counterLight = await container.renderToString(CounterLight, { props: { count: 1 } });
const result = await container.renderToString(Card, {
slots: {
default: counterLight,
},
});
expect(result).toContain('This is a card');
expect(result).toContain(counterLight);
});
|