chore: add `uidPrefix` to `createClassComponent`

pull/15403/head
paoloricciuti 2 years ago
parent 34d84fc54d
commit fb05aaff7d

@ -16,6 +16,7 @@ export interface ComponentConstructorOptions<
props?: Props;
context?: Map<any, any>;
hydrate?: boolean;
uidPrefix?: string;
intro?: boolean;
recover?: boolean;
sync?: boolean;

@ -116,7 +116,8 @@ class Svelte4Component {
props,
context: options.context,
intro: options.intro ?? false,
recover: options.recover
recover: options.recover,
uidPrefix: options.uidPrefix
});
// We don't flushSync for custom element wrappers or if the user doesn't want it

@ -1,14 +1,14 @@
// @vitest-environment jsdom
import type { CompileOptions } from '#compiler';
import * as fs from 'node:fs';
import { assert } from 'vitest';
import { compile_directory, should_update_expected } from '../helpers.js';
import { assert_html_equal } from '../html_equal.js';
import { suite, assert_ok, type BaseTest } from '../suite.js';
import { flushSync } from 'svelte';
import { createClassComponent } from 'svelte/legacy';
import { render } from 'svelte/server';
import type { CompileOptions } from '#compiler';
import { flushSync } from 'svelte';
import { assert } from 'vitest';
import { compile_directory } from '../helpers.js';
import { assert_html_equal } from '../html_equal.js';
import { assert_ok, suite, type BaseTest } from '../suite.js';
interface HydrationTest extends BaseTest {
load_compiled?: boolean;
@ -105,7 +105,8 @@ const { test, run } = suite<HydrationTest>(async (config, cwd) => {
component: (await import(`${cwd}/_output/client/main.svelte.js`)).default,
target,
hydrate: true,
props: config.props
props: config.props,
uidPrefix: config?.uid_prefix
});
console.warn = warn;
@ -166,6 +167,6 @@ const { test, run } = suite<HydrationTest>(async (config, cwd) => {
config.after_test?.();
}
});
export { test, assert_ok };
export { assert_ok, test };
await run(__dirname);

@ -13,6 +13,7 @@ declare module 'svelte' {
props?: Props;
context?: Map<any, any>;
hydrate?: boolean;
uidPrefix?: string;
intro?: boolean;
recover?: boolean;
sync?: boolean;

Loading…
Cancel
Save