Skip to content

Commit

Permalink
clicking on the modal overlay (masking layer) no longer closes the mo…
Browse files Browse the repository at this point in the history
…dals by default -- use the allowHideUsingOverlay option if you need that behavior now.
  • Loading branch information
jejacks0n committed Nov 12, 2011
1 parent e0ae319 commit 20b0767
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion spec/javascripts/mercury/modal_spec.js.coffee
Expand Up @@ -146,13 +146,21 @@ describe "Mercury.modal", ->
Mercury.trigger('resize')
expect(spy.callCount).toEqual(1)

describe "clicking on the overlay", ->
describe "clicking on the overlay (options.allowHideUsingOverlay = true)", ->

it "calls hide", ->
Mercury.modal.options.allowHideUsingOverlay = true
spy = spyOn(Mercury.modal, 'hide').andCallFake(=>)
jasmine.simulate.click($('.mercury-modal-overlay').get(0))
expect(spy.callCount).toEqual(1)

describe "clicking on the overlay (options.allowHideUsingOverlay = false)", ->

it "doesn't call hide", ->
spy = spyOn(Mercury.modal, 'hide').andCallFake(=>)
jasmine.simulate.click($('.mercury-modal-overlay').get(0))
expect(spy.callCount).toEqual(0)

describe "clicking on the close button", ->

it "calls hide", ->
Expand Down
2 changes: 1 addition & 1 deletion vendor/assets/javascripts/mercury/modal.js.coffee
Expand Up @@ -40,7 +40,7 @@ jQuery.extend Mercury.modal, {
Mercury.bind 'refresh', => @resize(true)
Mercury.bind 'resize', => @position()

@overlay.click => @hide()
@overlay.click => @hide() if @options.allowHideUsingOverlay

@titleElement.find('a').click => @hide()

Expand Down

0 comments on commit 20b0767

Please sign in to comment.