@@ -440,7 +440,6 @@ describe('integration', function () {
440
440
assert . equal ( breadcrumbs . length , 1 ) ;
441
441
442
442
assert . equal ( breadcrumbs [ 0 ] . type , 'ui_event' ) ;
443
- // NOTE: attributes re-ordered. should this be expected?
444
443
assert . equal ( breadcrumbs [ 0 ] . data . target , 'body > form#foo-form > input[name="foo"][placeholder="lol"]' ) ;
445
444
assert . equal ( breadcrumbs [ 0 ] . data . type , 'click' ) ;
446
445
}
@@ -481,7 +480,6 @@ describe('integration', function () {
481
480
assert . equal ( breadcrumbs . length , 1 ) ;
482
481
483
482
assert . equal ( breadcrumbs [ 0 ] . type , 'ui_event' ) ;
484
- // NOTE: attributes re-ordered. should this be expected?
485
483
assert . equal ( breadcrumbs [ 0 ] . data . target , 'body > form#foo-form > input[name="foo"][placeholder="lol"]' ) ;
486
484
assert . equal ( breadcrumbs [ 0 ] . data . type , 'click' ) ;
487
485
}
@@ -529,7 +527,6 @@ describe('integration', function () {
529
527
assert . equal ( breadcrumbs . length , 1 ) ;
530
528
531
529
assert . equal ( breadcrumbs [ 0 ] . type , 'ui_event' ) ;
532
- // NOTE: attributes re-ordered. should this be expected?
533
530
assert . equal ( breadcrumbs [ 0 ] . data . target , 'body > div.c > div.b > div.a' ) ;
534
531
assert . equal ( breadcrumbs [ 0 ] . data . type , 'click' ) ;
535
532
}
@@ -541,39 +538,17 @@ describe('integration', function () {
541
538
542
539
iframeExecute ( iframe , done ,
543
540
function ( ) {
544
- // keypress events are debounced 1000ms - wait until
545
- // the debounce finishes
546
- setTimeout ( done , 1001 ) ;
541
+ setTimeout ( done ) ;
547
542
548
543
// some browsers trigger onpopstate for load / reset breadcrumb state
549
544
Raven . _breadcrumbs = [ ] ;
550
545
551
546
// keypress <input/> twice
552
- var keypress1 = document . createEvent ( 'MouseEvent' ) ;
553
- keypress1 . initMouseEvent (
554
- "keypress" ,
555
- true /* bubble */ ,
556
- true /* cancelable */ ,
557
- window ,
558
- null ,
559
- 0 , 0 , 0 , 0 , /* coordinates */
560
- false , false , false , false , /* modifier keys */
561
- 0 /*left*/ ,
562
- null
563
- ) ;
547
+ var keypress1 = document . createEvent ( 'KeyboardEvent' ) ;
548
+ keypress1 . initKeyboardEvent ( "keypress" , true , true , window , "b" , 66 , 0 , "" , false ) ;
564
549
565
- var keypress2 = document . createEvent ( 'MouseEvent' ) ;
566
- keypress2 . initMouseEvent (
567
- "keypress" ,
568
- true /* bubble */ ,
569
- true /* cancelable */ ,
570
- window ,
571
- null ,
572
- 0 , 0 , 0 , 0 , /* coordinates */
573
- false , false , false , false , /* modifier keys */
574
- 0 /*left*/ ,
575
- null
576
- ) ;
550
+ var keypress2 = document . createEvent ( 'KeyboardEvent' ) ;
551
+ keypress2 . initKeyboardEvent ( "keypress" , true , true , window , "a" , 65 , 0 , "" , false ) ;
577
552
578
553
var input = document . getElementsByTagName ( 'input' ) [ 0 ] ;
579
554
input . dispatchEvent ( keypress1 ) ;
@@ -586,7 +561,6 @@ describe('integration', function () {
586
561
assert . equal ( breadcrumbs . length , 1 ) ;
587
562
588
563
assert . equal ( breadcrumbs [ 0 ] . type , 'ui_event' ) ;
589
- // NOTE: attributes re-ordered. should this be expected?
590
564
assert . equal ( breadcrumbs [ 0 ] . data . target , 'body > form#foo-form > input[name="foo"][placeholder="lol"]' ) ;
591
565
assert . equal ( breadcrumbs [ 0 ] . data . type , 'input' ) ;
592
566
}
@@ -603,22 +577,12 @@ describe('integration', function () {
603
577
// some browsers trigger onpopstate for load / reset breadcrumb state
604
578
Raven . _breadcrumbs = [ ] ;
605
579
606
- // click <input/>
607
- var evt = document . createEvent ( 'MouseEvent' ) ;
608
- evt . initMouseEvent (
609
- "keypress" ,
610
- true /* bubble */ ,
611
- true /* cancelable */ ,
612
- window ,
613
- null ,
614
- 0 , 0 , 0 , 0 , /* coordinates */
615
- false , false , false , false , /* modifier keys */
616
- 0 /*left*/ ,
617
- null
618
- ) ;
580
+ // keypress <input/>
581
+ var keypress = document . createEvent ( 'KeyboardEvent' ) ;
582
+ keypress . initKeyboardEvent ( "keypress" , true , true , window , "b" , 66 , 0 , "" , false ) ;
619
583
620
584
var input = document . getElementsByTagName ( 'input' ) [ 0 ] ;
621
- input . dispatchEvent ( evt ) ;
585
+ input . dispatchEvent ( keypress ) ;
622
586
623
587
foo ( ) ; // throw exception
624
588
} ,
@@ -630,7 +594,6 @@ describe('integration', function () {
630
594
assert . equal ( breadcrumbs . length , 2 ) ;
631
595
632
596
assert . equal ( breadcrumbs [ 0 ] . type , 'ui_event' ) ;
633
- // NOTE: attributes re-ordered. should this be expected?
634
597
assert . equal ( breadcrumbs [ 0 ] . data . target , 'body > form#foo-form > input[name="foo"][placeholder="lol"]' ) ;
635
598
assert . equal ( breadcrumbs [ 0 ] . data . type , 'input' ) ;
636
599
}
@@ -647,23 +610,13 @@ describe('integration', function () {
647
610
// some browsers trigger onpopstate for load / reset breadcrumb state
648
611
Raven . _breadcrumbs = [ ] ;
649
612
650
- // keypress <input/>
651
- var keypressEvent = document . createEvent ( 'MouseEvent' ) ;
652
- keypressEvent . initMouseEvent (
653
- "keypress" ,
654
- true /* bubble */ ,
655
- true /* cancelable */ ,
656
- window ,
657
- null ,
658
- 0 , 0 , 0 , 0 , /* coordinates */
659
- false , false , false , false , /* modifier keys */
660
- 0 /*left*/ ,
661
- null
662
- ) ;
613
+ // 1st keypress <input/>
614
+ var keypress1 = document . createEvent ( 'KeyboardEvent' ) ;
615
+ keypress1 . initKeyboardEvent ( "keypress" , true , true , window , "b" , 66 , 0 , "" , false ) ;
663
616
664
617
// click <input/>
665
- var clickEvent = document . createEvent ( 'MouseEvent' ) ;
666
- clickEvent . initMouseEvent (
618
+ var click = document . createEvent ( 'MouseEvent' ) ;
619
+ click . initMouseEvent (
667
620
"click" ,
668
621
true /* bubble */ ,
669
622
true /* cancelable */ ,
@@ -675,26 +628,34 @@ describe('integration', function () {
675
628
null
676
629
) ;
677
630
631
+ // 2nd keypress
632
+ var keypress2 = document . createEvent ( 'KeyboardEvent' ) ;
633
+ keypress2 . initKeyboardEvent ( "keypress" , true , true , window , "a" , 65 , 0 , "" , false ) ;
634
+
678
635
var input = document . getElementsByTagName ( 'input' ) [ 0 ] ;
679
- input . dispatchEvent ( keypressEvent ) ;
680
- input . dispatchEvent ( clickEvent ) ;
636
+ input . dispatchEvent ( keypress1 ) ;
637
+ input . dispatchEvent ( click ) ;
638
+ input . dispatchEvent ( keypress2 ) ;
681
639
} ,
682
640
function ( ) {
683
641
var Raven = iframe . contentWindow . Raven ,
684
642
breadcrumbs = Raven . _breadcrumbs ;
685
643
686
644
// 2x `ui_event`
687
- assert . equal ( breadcrumbs . length , 2 ) ;
645
+ assert . equal ( breadcrumbs . length , 3 ) ;
688
646
689
647
assert . equal ( breadcrumbs [ 0 ] . type , 'ui_event' ) ;
690
- // NOTE: attributes re-ordered. should this be expected?
691
648
assert . equal ( breadcrumbs [ 0 ] . data . target , 'body > form#foo-form > input[name="foo"][placeholder="lol"]' ) ;
692
649
assert . equal ( breadcrumbs [ 0 ] . data . type , 'input' ) ;
693
650
694
651
assert . equal ( breadcrumbs [ 1 ] . type , 'ui_event' ) ;
695
- // NOTE: attributes re-ordered. should this be expected?
696
652
assert . equal ( breadcrumbs [ 1 ] . data . target , 'body > form#foo-form > input[name="foo"][placeholder="lol"]' ) ;
697
653
assert . equal ( breadcrumbs [ 1 ] . data . type , 'click' ) ;
654
+
655
+ assert . equal ( breadcrumbs [ 2 ] . type , 'ui_event' ) ;
656
+ assert . equal ( breadcrumbs [ 2 ] . data . target , 'body > form#foo-form > input[name="foo"][placeholder="lol"]' ) ;
657
+ assert . equal ( breadcrumbs [ 2 ] . data . type , 'input' ) ;
658
+
698
659
}
699
660
) ;
700
661
} ) ;
0 commit comments