Skip to content

Instantly share code, notes, and snippets.

@ngty
Created January 13, 2009 14:31
Show Gist options
  • Save ngty/46468 to your computer and use it in GitHub Desktop.
Save ngty/46468 to your computer and use it in GitHub Desktop.
//
// 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);
});
}
#
# 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