Skip to content

Commit

Permalink
Fire change event from SELECT, not OPTION
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaudanza committed May 18, 2015
1 parent e3fc259 commit 03ecc57
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/capybara/poltergeist/client/agent.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ class PoltergeistAgent.Node
changed: ->
event = document.createEvent('HTMLEvents')
event.initEvent('change', true, false)
@element.dispatchEvent(event)

# In the case of an OPTION tag, the change event should come
# from the parent SELECT
if @element.nodeName == 'OPTION'
element = @element.parentNode
else
element = @element

element.dispatchEvent(event)

input: ->
event = document.createEvent('HTMLEvents')
Expand Down

0 comments on commit 03ecc57

Please sign in to comment.