@@ -461,6 +461,60 @@ describe('SSR hydration', () => {
461
461
expect ( text . textContent ) . toBe ( 'bye' )
462
462
} )
463
463
464
+ test ( 'handle click error in ssr mode' , async ( ) => {
465
+ const App = {
466
+ setup ( ) {
467
+ const throwError = ( ) => {
468
+ throw new Error ( 'Sentry Error' )
469
+ }
470
+ return { throwError }
471
+ } ,
472
+ template : `
473
+ <div>
474
+ <button class="parent-click" @click="throwError">click me</button>
475
+ </div>`
476
+ }
477
+
478
+ const container = document . createElement ( 'div' )
479
+ // server render
480
+ container . innerHTML = await renderToString ( h ( App ) )
481
+ // hydrate
482
+ const app = createSSRApp ( App )
483
+ const handler = ( app . config . errorHandler = jest . fn ( ) )
484
+ app . mount ( container )
485
+ // assert interactions
486
+ // parent button click
487
+ triggerEvent ( 'click' , container . querySelector ( '.parent-click' ) ! )
488
+ expect ( handler ) . toHaveBeenCalled ( )
489
+ } )
490
+
491
+ test ( 'handle blur error in ssr mode' , async ( ) => {
492
+ const App = {
493
+ setup ( ) {
494
+ const throwError = ( ) => {
495
+ throw new Error ( 'Sentry Error' )
496
+ }
497
+ return { throwError }
498
+ } ,
499
+ template : `
500
+ <div>
501
+ <input class="parent-click" @blur="throwError"/>
502
+ </div>`
503
+ }
504
+
505
+ const container = document . createElement ( 'div' )
506
+ // server render
507
+ container . innerHTML = await renderToString ( h ( App ) )
508
+ // hydrate
509
+ const app = createSSRApp ( App )
510
+ const handler = ( app . config . errorHandler = jest . fn ( ) )
511
+ app . mount ( container )
512
+ // assert interactions
513
+ // parent blur event
514
+ triggerEvent ( 'blur' , container . querySelector ( '.parent-click' ) ! )
515
+ expect ( handler ) . toHaveBeenCalled ( )
516
+ } )
517
+
464
518
test ( 'Suspense' , async ( ) => {
465
519
const AsyncChild = {
466
520
async setup ( ) {
0 commit comments