mirror of https://github.com/sveltejs/svelte
pull/18058/head
parent
7f9021a056
commit
ce4442d663
@ -0,0 +1,9 @@
|
||||
<svelte:options customRenderer={null} />
|
||||
|
||||
<script>
|
||||
let { message } = $props();
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<span>{message}</span>
|
||||
</div>
|
||||
@ -0,0 +1,14 @@
|
||||
import { test } from '../../test-dom.test';
|
||||
|
||||
export default test({
|
||||
// this is the custom rendered component...it doesn't have anything inside because the part of the renderer
|
||||
// responsible for the interleaving is the `before` function on the comment node which only push into `dom_elements` in this case
|
||||
html: '<custom></custom>',
|
||||
test({ assert, dom_elements }) {
|
||||
// we then get the element out of dom_elements
|
||||
const [div] = dom_elements;
|
||||
// check that is an actual DOM element and that it has the expected content
|
||||
assert.instanceOf(div, HTMLDivElement);
|
||||
assert.equal(div.outerHTML, '<div><span>hello from child</span></div>');
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,7 @@
|
||||
<script>
|
||||
import Child from './Child.svelte';
|
||||
</script>
|
||||
|
||||
<custom>
|
||||
<Child message="hello from child"></Child>
|
||||
</custom>
|
||||
@ -0,0 +1,8 @@
|
||||
// @vitest-environment jsdom
|
||||
import { custom_renderer_suite, ok } from './shared';
|
||||
|
||||
const { test, run } = custom_renderer_suite();
|
||||
|
||||
export { test, ok };
|
||||
|
||||
await run(__dirname, 'samples-dom');
|
||||
Loading…
Reference in new issue