File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,4 +214,23 @@ describe('bind', () => {
214214 el1 . click ( )
215215 expect ( instance . foo ) . to . have . been . called . exactly ( 1 )
216216 } )
217+
218+ it ( 'will rebind elements if the attribute changes' , async function ( ) {
219+ const instance = document . createElement ( 'bind-test-element' )
220+ chai . spy . on ( instance , 'foo' )
221+ root . appendChild ( instance )
222+ const button = document . createElement ( 'button' )
223+ button . setAttribute ( 'data-action' , 'submit:bind-test-element#foo' )
224+ instance . appendChild ( button )
225+ bind ( instance )
226+ listenForBind ( root )
227+ await waitForNextAnimationFrame ( )
228+ button . click ( )
229+ expect ( instance . foo ) . to . have . been . called . exactly ( 0 )
230+ button . setAttribute ( 'data-action' , 'click:bind-test-element#foo' )
231+ await waitForNextAnimationFrame ( )
232+ await waitForNextAnimationFrame ( )
233+ button . click ( )
234+ expect ( instance . foo ) . to . have . been . called . exactly ( 1 )
235+ } )
217236} )
You can’t perform that action at this time.
0 commit comments