Skip to content

Instantly share code, notes, and snippets.

View mattgibson's full-sized avatar

Matt Gibson mattgibson

View GitHub Profile
@jtanium
jtanium / token_input_helpers.rb
Created September 20, 2011 17:11
TokenInput Cucumber Helper
module TokenInputHelpers
def token_input(locator, options)
raise "Must pass a hash containing 'with'" unless options.is_a?(Hash) && options.has_key?(:with)
field = _find_fillable_field(locator) # find the field that will ultimately be sent to the server, the one the user intends to fill in
# Delete the existing token, if present
begin
# This xpath is finds a <ul class='token-input-list'/> followed by a <input id="ID"/>
within(:xpath, "//ul[@class='token-input-list' and following-sibling::input[@id='#{field[:id]}']]") do
@brianjmiller
brianjmiller / gist:649049
Created October 27, 2010 13:37
YUI3 Dynamic Context Menu on YUI2 Data Table Record
Y.delegate(
"contextmenu",
function (e) {
// prevent the browser's own context menu
e.preventDefault();
var record = this._data_table.getRecord( e.target.get("id") );
// build a list of menu items based on the _options data in the record
var menu_items = "";