Skip to content

Commit daafe18

Browse files
committed
Add test
1 parent 5da33eb commit daafe18

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/cypress/integration/error-handling.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,20 @@ test('evaluation with syntax error',
200200
assertConsoleInterceptorHadErrorWithCorrectElement(),
201201
true
202202
)
203+
204+
test('custom error handler',
205+
[html`
206+
<div id="custom">
207+
<div x-init="doesNotExist()"></div>
208+
</div>
209+
`,
210+
setupConsoleInterceptor( "custom" ) + `
211+
Alpine.setErrorHandler((error, el) => {
212+
// Report parent element instead
213+
console.warn(error, el.parentNode)
214+
})
215+
`,
216+
],
217+
assertConsoleInterceptorHadErrorWithCorrectElement(),
218+
true
219+
)

0 commit comments

Comments
 (0)