chore: fix `$props.id` tests (#15294)

* chore: fix `$props.id` tests

* chore: reset uid between tests
pull/15301/head
Paolo Ricciuti 7 months ago committed by GitHub
parent b6bf735a23
commit 8b977253f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -252,6 +252,10 @@ export function append(anchor, dom) {
let uid = 1;
export function reset_props_id() {
uid = 1;
}
/**
* Create (or hydrate) an unique UID for the component instance.
*/

@ -11,6 +11,7 @@ import { setup_html_equal } from '../html_equal.js';
import { raf } from '../animation-helpers.js';
import type { CompileOptions } from '#compiler';
import { suite_with_variants, type BaseTest } from '../suite.js';
import { reset_props_id } from '../../src/internal/client/dom/template.js';
type Assert = typeof import('vitest').assert & {
htmlEqual(a: string, b: string, description?: string): void;
@ -345,6 +346,7 @@ async function run_test_variant(
if (runes) {
props = proxy({ ...(config.props || {}) });
reset_props_id();
if (manual_hydrate) {
hydrate_fn = () => {
instance = hydrate(mod.default, {

@ -43,8 +43,6 @@ export default test({
`
);
} else {
// `c6` because this runs after the `dom` tests
// (slightly brittle but good enough for now)
assert.htmlEqual(
target.innerHTML,
`
@ -53,7 +51,7 @@ export default test({
<p>s2</p>
<p>s3</p>
<p>s4</p>
<p>c6</p>
<p>c1</p>
`
);
}

Loading…
Cancel
Save