diff --git a/src/bootstrap-dialogs.coffee b/src/bootstrap-dialogs.coffee index 49dd464..b6042d3 100644 --- a/src/bootstrap-dialogs.coffee +++ b/src/bootstrap-dialogs.coffee @@ -14,6 +14,8 @@ mkbutton = (text, btnClass) -> normalizeButtons = (buttons) -> for button in buttons + handler = null + if button instanceof Array handler = button[1] button = button[0] diff --git a/test/bootstrap-dialogs-test.coffee b/test/bootstrap-dialogs-test.coffee index 6f4779d..12fec29 100644 --- a/test/bootstrap-dialogs-test.coffee +++ b/test/bootstrap-dialogs-test.coffee @@ -202,6 +202,14 @@ buster.testCase 'Bootstrap.Dialogs', .click() assert.calledOnce(spy) + 'does not leak handlers between buttons': -> + spy = @spy() + dialog(buttons: [ + ['OK', spy] + $('')[0] + ]).$el.find('a').click() + refute.called(spy) + 'buttons can be DOM elements': -> $el = dialog(title: 'Title', body: 'Body', buttons: [ $('