See http://ryanbrooks.co.uk/posts/2014-02-06-geb-doubleclick.html for more information.
Last active
August 29, 2015 13:56
-
-
Save spikeheap/8845429 to your computer and use it in GitHub Desktop.
Demo of double-click event handling in Geb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import geb.spock.GebReportingSpec | |
| class failingSpec extends GebReportingSpec { | |
| def "double clicking highlights the second div"(){ | |
| def elementIwant = $('div', text: 'Double-clickable div') | |
| when: "I click an element" | |
| elementIwant.click() // Works | |
| then: "a div has the activated class applied to it" | |
| $('div', text: 'single-clicked').hasClass("activated") | |
| when: "I double-click an element" | |
| elementIwant.dblClick() // Does nothing | |
| then: "a different div has the activated class applied to it" | |
| $('div', text: 'double-clicked').hasClass("activated") // assertion fails | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import geb.spock.GebReportingSpec | |
| class passingSpec extends GebReportingSpec { | |
| def "double clicking highlights the second div"(){ | |
| def elementIwant = $('div', text: 'Double-clickable div') | |
| when: "I click an element" | |
| elementIwant.click() // Works | |
| then: "a div has the activated class applied to it" | |
| $('div', text: 'single-clicked').hasClass("activated") | |
| when: "I double-click an element" | |
| interact { doubleClick(elementIwant) } | |
| then: "a different div has the activated class applied to it" | |
| $('div', text: 'double-clicked').hasClass("activated") // assertion passes | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment