File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,6 +106,22 @@ describe('bind', () => {
106106 expect ( calls ) . to . have . nested . property ( '[1][0].type' , 'submit' )
107107 } )
108108
109+ it ( 'can bind multiple actions' , ( ) => {
110+ const instance = document . createElement ( 'bind-test-element' )
111+ chai . spy . on ( instance , 'foo' )
112+ chai . spy . on ( instance , 'bar' )
113+ const el = document . createElement ( 'div' )
114+ el . setAttribute ( 'data-action' , `click:bind-test-element#foo\nclick:bind-test-element#bar` )
115+ instance . appendChild ( el )
116+ bind ( instance )
117+ expect ( instance . foo ) . to . have . not . been . called ( )
118+ el . dispatchEvent ( new CustomEvent ( 'click' ) )
119+ expect ( instance . foo ) . to . have . been . called . exactly ( 1 )
120+ expect ( instance . bar ) . to . have . been . called . exactly ( 1 )
121+ expect ( instance . foo . __spy . calls ) . to . have . nested . property ( '[0][0].type' , 'click' )
122+ expect ( instance . bar . __spy . calls ) . to . have . nested . property ( '[0][0].type' , 'click' )
123+ } )
124+
109125 it ( 'can bind multiple elements to the same event' , ( ) => {
110126 const instance = document . createElement ( 'bind-test-element' )
111127 chai . spy . on ( instance , 'foo' )
You can’t perform that action at this time.
0 commit comments