@@ -1673,6 +1673,84 @@ for (var idx in frames) {
16731673 ) ;
16741674 } ) ;
16751675
1676+ it ( 'should record click events that were handled using an object with handleEvent property and call original callback' , function ( done ) {
1677+ var iframe = this . iframe ;
1678+
1679+ iframeExecute (
1680+ iframe ,
1681+ done ,
1682+ function ( ) {
1683+ var frame = this ;
1684+ frame . handleEventCalled = false ;
1685+
1686+ var input = document . getElementsByTagName ( 'input' ) [ 0 ] ;
1687+ input . addEventListener ( 'click' , {
1688+ handleEvent ( ) {
1689+ frame . handleEventCalled = true ;
1690+ } ,
1691+ } ) ;
1692+ input . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
1693+
1694+ Sentry . captureMessage ( 'test' ) ;
1695+ } ,
1696+ function ( sentryData ) {
1697+ if ( IS_LOADER ) {
1698+ // The async loader doesn't wrap event listeners, but we should receive the event without breadcrumbs
1699+ assert . lengthOf ( sentryData , 1 ) ;
1700+ return done ( ) ;
1701+ }
1702+ var breadcrumbs = iframe . contentWindow . sentryBreadcrumbs ;
1703+
1704+ assert . equal ( breadcrumbs . length , 1 ) ;
1705+ assert . equal ( breadcrumbs [ 0 ] . category , 'ui.click' ) ;
1706+ assert . equal ( breadcrumbs [ 0 ] . message , 'body > form#foo-form > input[name="foo"]' ) ;
1707+
1708+ assert . equal ( iframe . contentWindow . handleEventCalled , true ) ;
1709+
1710+ done ( ) ;
1711+ }
1712+ ) ;
1713+ } ) ;
1714+
1715+ it ( 'should record keypress events that were handled using an object with handleEvent property and call original callback' , function ( done ) {
1716+ var iframe = this . iframe ;
1717+
1718+ iframeExecute (
1719+ iframe ,
1720+ done ,
1721+ function ( ) {
1722+ var frame = this ;
1723+ frame . handleEventCalled = false ;
1724+
1725+ var input = document . getElementsByTagName ( 'input' ) [ 0 ] ;
1726+ input . addEventListener ( 'keypress' , {
1727+ handleEvent ( ) {
1728+ frame . handleEventCalled = true ;
1729+ } ,
1730+ } ) ;
1731+ input . dispatchEvent ( new KeyboardEvent ( 'keypress' ) ) ;
1732+
1733+ Sentry . captureMessage ( 'test' ) ;
1734+ } ,
1735+ function ( sentryData ) {
1736+ if ( IS_LOADER ) {
1737+ // The async loader doesn't wrap event listeners, but we should receive the event without breadcrumbs
1738+ assert . lengthOf ( sentryData , 1 ) ;
1739+ return done ( ) ;
1740+ }
1741+ var breadcrumbs = iframe . contentWindow . sentryBreadcrumbs ;
1742+
1743+ assert . equal ( breadcrumbs . length , 1 ) ;
1744+ assert . equal ( breadcrumbs [ 0 ] . category , 'ui.input' ) ;
1745+ assert . equal ( breadcrumbs [ 0 ] . message , 'body > form#foo-form > input[name="foo"]' ) ;
1746+
1747+ assert . equal ( iframe . contentWindow . handleEventCalled , true ) ;
1748+
1749+ done ( ) ;
1750+ }
1751+ ) ;
1752+ } ) ;
1753+
16761754 it (
16771755 _alt ( 'should record history.[pushState|replaceState] changes as navigation breadcrumbs' , IS_LOADER ) ,
16781756 function ( done ) {
0 commit comments