Created
January 13, 2009 14:31
-
-
Save ngty/46468 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
// | |
// Tracking of action's status | |
// | |
ActionStatus = { | |
flags: { completed: false }, | |
reset: function() { this.flags.completed = false; }, | |
update: function(flags) { this.flags = flags; }, | |
completed: function() { | |
var flag = this.flags.completed; | |
this.reset(); | |
return flag; | |
} | |
} | |
// | |
// Register actions for document | |
// | |
$(document).ready(function(){ | |
function toggle_assignment_elements() { | |
// do something useful | |
ActionStatus.update({completed:true}); | |
} | |
$.each(['unassigned','assigned'],function(idx,css) { | |
$('p.'+css+' :checkbox'). | |
click(toggle_assignment_elements); | |
}); | |
} | |
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
# | |
# Note that i'm using cucumber and have mixed | |
# Selenium::Client::Base into cucumber's world. | |
# | |
When /^I (uncheck|check) "(w+)"$/ do | label, check | | |
checkbox = labelled_checkbox[label] | |
if ( checkbox['checked'] and check=~/^u/ ) or ( checkbox['checked'].nil? and check=~/^c/ ) | |
click cbox.locator | |
wait_for_condition 'selenium.browserbot.getCurrentWindow().ActionStatus.completed()' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment