@@ -568,7 +568,7 @@ describe("Wrapping AbortController as a state machine", () => {
568568 } ) ;
569569
570570 describe ( "AbortOwner" , ( ) => {
571- it ( "aborts" , async ( ) => {
571+ it . skip ( "aborts" , async ( ) => {
572572 const machine = start ( AbortOwner ) ;
573573
574574 expect ( machine . current ) . toEqual ( "initial" ) ;
@@ -587,6 +587,34 @@ describe("Wrapping AbortController as a state machine", () => {
587587 } ) ;
588588} ) ;
589589
590+ describe ( "Button click" , ( ) => {
591+ function ButtonClickListener ( button : HTMLButtonElement ) {
592+ function * initial ( ) {
593+ yield on ( "click" , clicked ) ;
594+ yield listenTo ( button , "click" ) ;
595+ }
596+ function * clicked ( ) { }
597+
598+ return initial ;
599+ }
600+
601+ it ( "listens when button clicks" , ( ) => {
602+ const button = document . createElement ( 'button' ) ;
603+ const machine = start ( ButtonClickListener . bind ( null , button ) ) ;
604+
605+ expect ( machine . current ) . toEqual ( "initial" ) ;
606+ expect ( machine . changeCount ) . toEqual ( 0 ) ;
607+
608+ button . click ( ) ;
609+ expect ( machine . current ) . toEqual ( "clicked" ) ;
610+ expect ( machine . changeCount ) . toEqual ( 1 ) ;
611+
612+ button . click ( ) ;
613+ expect ( machine . current ) . toEqual ( "clicked" ) ;
614+ expect ( machine . changeCount ) . toEqual ( 1 ) ;
615+ } ) ;
616+ } ) ;
617+
590618/*describe("Counter", () => {
591619 function* Counter() {
592620 function* initial() {
0 commit comments