transform assertions

pull/9482/head
Rich Harris 3 years ago
parent 87b322bbe2
commit a1349823f4

@ -101,5 +101,13 @@ export const global_visitors = {
return b.call(b.thunk(b.block(statements)));
}
}
},
// @ts-expect-error
TSAsExpression(node, context) {
return context.visit(node.expression);
},
// @ts-expect-error
TSNonNullExpression(node, context) {
return context.visit(node.expression);
}
};

@ -0,0 +1,11 @@
import { test } from '../../test';
export default test({
html: '<button>clicks: 0</button>',
async test({ assert, target }) {
const btn = target.querySelector('button');
await btn?.click();
assert.htmlEqual(target.innerHTML, `<button>clicks: 1</button>`);
}
});

@ -0,0 +1,10 @@
<script>
let count = $state(0);
</script>
<button
on:click={(e: MouseEvent) => {
const next: number = count + 1;
count = next! as number;
}}
>clicks: {count}</button>
Loading…
Cancel
Save