jonleighton/poltergeist — pull request #225 by Gazler (2013-01-04 15:47:13+00:00)
Title: Bug iframe click

As mentioned in issue #222, when clicking an iframe, the position of the click is calculated from the top left iframe but performed from the top left of the page. This means that the clicks do not hit the intended target.

This solution is largely in JavaScript and it performs the following steps:

1) When pushFrame is called, the position of the iframe is retrieved using either the id or name of the frame.
2) This is stored in a frameOffsets array
3) When a click event happens (after the test but before the trigger) the offset for each parent frame is added to the position and the click is triggered.
4) When popFrame is called, the top result is popped from the offset array.

The test by @tommyh has been pulled in prior to this commit.