You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/packages/svelte/tests/runtime-runes/samples/event-handler-invalid-values/_config.js

39 lines
841 B

import { test } from '../../test';
export default test({
mode: ['client'],
compileOptions: {
dev: true
},
test({ assert, target, warnings, logs, errors }) {
const handler = (/** @type {any} */ e) => {
e.stopImmediatePropagation();
};
window.addEventListener('error', handler, true);
const [b1, b2, b3] = target.querySelectorAll('button');
b1.click();
assert.deepEqual(logs, []);
assert.deepEqual(errors, []);
b2.click();
assert.deepEqual(logs, ['clicked']);
assert.deepEqual(errors, []);
logs.length = 0;
b3.click();
assert.deepEqual(logs, []);
assert.deepEqual(warnings, [
'`click` handler at main.svelte:10:17 should be a function. Did you mean to add a leading `() =>`?'
]);
assert.include(errors[0], 'is not a function');
window.removeEventListener('error', handler, true);
}
});