Created
September 16, 2011 12:37
-
-
Save chromeragnarok/1222036 to your computer and use it in GitHub Desktop.
This file contains 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
// JS Stuffs here | |
$("#add-new").droppable({ | |
accept: ".draggable-stuffs", | |
drop: handleDrop | |
}); | |
function handleAddNewDrop(event, ui) { | |
// do stuffs with your event and ui params... or not. | |
} | |
# some web steps to be called on your cukes... | |
When /^I drag the div "([^"]*)" to the add-new dropzone$/ do |div_id| | |
javascript = <<-eos | |
var ui = { draggable: $("#{div_id}")}; // this is a mock ui object that is to be passed in the method | |
handleAddNewDrop($.Event("drop"), ui); | |
eos | |
page.execute_script javascript | |
end | |
When /^I change the group\-box number (\d+) title to "([^"]*)"$/ do |order, new_title| | |
javascript = <<-eos | |
var selectedGroupBox = $($(".group-box")[#{order}]); | |
selectedGroupBox.find(".edit").click(); | |
selectedGroupBox.find("input").val("#{new_title}"); | |
selectedGroupBox.find("input").blur(); | |
eos | |
page.execute_script javascript | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These are just some examples how you can actually trigger events and call functions from your cukes.