Skip to content

Commit e71036a

Browse files
committed
regression test
1 parent 5d7d3f7 commit e71036a

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { test } from '../../test';
2+
3+
/** @type {typeof console.warn} */
4+
let warn;
5+
6+
/** @type {any[]} */
7+
let warnings = [];
8+
9+
export default test({
10+
html: `<button>clicks: 0</button>`,
11+
12+
compileOptions: {
13+
dev: true
14+
},
15+
16+
before_test: () => {
17+
warn = console.warn;
18+
19+
console.warn = (...args) => {
20+
warnings.push(...args);
21+
};
22+
},
23+
24+
after_test: () => {
25+
console.warn = warn;
26+
warnings = [];
27+
},
28+
29+
async test({ assert, target }) {
30+
const btn = target.querySelector('button');
31+
await btn?.click();
32+
33+
assert.htmlEqual(target.innerHTML, `<button>clicks: 1</button>`);
34+
35+
assert.deepEqual(warnings, []);
36+
}
37+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
import { global } from './state.svelte.js';
3+
4+
global.a = { b: 0 };
5+
</script>
6+
7+
<button onclick={() => global.a.b += 1}>
8+
clicks: {global.a.b}
9+
</button>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export let global = $state({});

0 commit comments

Comments
 (0)