jnicklas/capybara — pull request #749 by akasper (2012-07-10 16:20:48+00:00)
Title: Fix onchange edgecase in Selenium driver

Given:

* a textfield or textarea with pre-populated text
* an onchange event that formats that text
* and a call to node.set(value)

It is possible to trigger the onchange event twice, thereby not actually setting the field's value correctly.

Consider the case where the onchange event validates and reformats a textfield. If the event reformats a blank field, then the #clear is not going to work as intended, because it triggers onchange.

Failing spec and a fix attached.