Skip to content

Commit 7c95a0e

Browse files
committed
remove some now obsolete tests
1 parent 88a83d6 commit 7c95a0e

File tree

33 files changed

+56
-434
lines changed

33 files changed

+56
-434
lines changed

packages/svelte/tests/runtime-runes/samples/non-local-mutation-global-2/_config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/svelte/tests/runtime-runes/samples/non-local-mutation-global-2/child.svelte

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/svelte/tests/runtime-runes/samples/non-local-mutation-global-2/main.svelte

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/svelte/tests/runtime-runes/samples/non-local-mutation-inherited-owner/_config.js renamed to packages/svelte/tests/runtime-runes/samples/non-local-mutation-inherited-owner-1/_config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let warn;
88
let warnings = [];
99

1010
export default test({
11-
html: `<button>clicks: 0</button>`,
11+
html: `<button>[]</button>`,
1212

1313
compileOptions: {
1414
dev: true
@@ -34,8 +34,8 @@ export default test({
3434
btn?.click();
3535
});
3636

37-
assert.htmlEqual(target.innerHTML, `<button>clicks: 1</button>`);
37+
assert.htmlEqual(target.innerHTML, `<button>[foo]</button>`);
3838

39-
assert.deepEqual(warnings, []);
39+
assert.deepEqual(warnings, [], 'expected getContext to have widened ownership');
4040
}
4141
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
import { setContext } from 'svelte';
3+
import Sub from './sub.svelte';
4+
5+
let list = $state([]);
6+
setContext('list', list);
7+
</script>
8+
9+
<Sub />
Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,24 @@
11
import { flushSync } from 'svelte';
22
import { test } from '../../test';
33

4-
/** @type {typeof console.warn} */
5-
let warn;
6-
7-
/** @type {any[]} */
8-
let warnings = [];
9-
104
export default test({
11-
html: `<button>clicks: 0</button>`,
12-
135
compileOptions: {
146
dev: true
157
},
168

17-
before_test: () => {
18-
warn = console.warn;
19-
20-
console.warn = (...args) => {
21-
warnings.push(...args);
22-
};
23-
},
9+
test({ assert, target, warnings }) {
10+
const [btn1, btn2] = target.querySelectorAll('button');
2411

25-
after_test: () => {
26-
console.warn = warn;
27-
warnings = [];
28-
},
12+
flushSync(() => {
13+
btn1.click();
14+
});
2915

30-
test({ assert, target }) {
31-
const btn = target.querySelector('button');
16+
assert.deepEqual(warnings.length, 0);
3217

3318
flushSync(() => {
34-
btn?.click();
19+
btn2.click();
3520
});
3621

37-
assert.htmlEqual(target.innerHTML, `<button>clicks: 1</button>`);
38-
39-
assert.deepEqual(warnings, []);
22+
assert.deepEqual(warnings.length, 1);
4023
}
4124
});
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<script>
2-
import { global } from './state.svelte.js';
1+
<script lang="ts">
2+
import Sub from './sub.svelte';
3+
import { create_my_state } from './state.svelte';
34
4-
global.a = { b: 0 };
5+
const myState = create_my_state();
56
</script>
67

7-
<button onclick={() => global.a.b += 1}>
8-
clicks: {global.a.b}
9-
</button>
8+
<Sub count={myState.my_state} inc={myState.inc} />
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
export let global = $state({});
1+
export function create_my_state() {
2+
const my_state = $state({
3+
a: 0
4+
});
5+
6+
function inc() {
7+
my_state.a++;
8+
}
9+
10+
return {
11+
my_state,
12+
inc
13+
};
14+
}

0 commit comments

Comments
 (0)