jnicklas/capybara — pull request #750 by akasper (2012-07-12 12:29:26+00:00)
Title: Handle onchange edgecase in Selenium driver, attempt 2

Second attempt at resolving https://github.com/jnicklas/capybara/pull/749

From that request's description:
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.