Sha256: 401dc95ba09dcdeed5555f5824e09aa8500522a283c0e0f3134ce5136800b2ea
Contents?: true
Size: 1.94 KB
Versions: 6
Compression:
Stored size: 1.94 KB
Contents
# # jQuery Selector Assertions (modifications to the prototype/scriptaculous assertions) # # From http://pastie.org/303776 # # 1. Make sure to use '#' prefix when referring to element IDs in assert_select_rjs(), # like this: # assert_select_rjs :replace_html, '#someid' # instead of prototype convention: # assert_select_rjs :replace_html, 'someid' # # We monkey-patch some RJS-matching constants for assert_select_rjs to work # with jQuery-based code as opposed to Prototype's: # module ActionController module Assertions module SelectorAssertions silence_warnings do RJS_PATTERN_HTML = "\"((\\\\\"|[^\"])*)\"" # RJS_ANY_ID = "\"([^\"])*\"" # better match with single or double quoted ids RJS_ANY_ID = "[\"']([^\"])*[\"']" RJS_STATEMENTS = { :chained_replace => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.replaceWith\\(#{RJS_PATTERN_HTML}\\)", :chained_replace_html => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.updateWith\\(#{RJS_PATTERN_HTML}\\)", :replace_html => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.html\\(#{RJS_PATTERN_HTML}\\)", :replace => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.replaceWith\\(#{RJS_PATTERN_HTML}\\)", :insert_top => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.prepend\\(#{RJS_PATTERN_HTML}\\)", :insert_bottom => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.append\\(#{RJS_PATTERN_HTML}\\)", :effect => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.effect\\(", :highlight => "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.effect\\('highlight'" } [:remove, :show, :hide, :toggle, :reset].each do |action| RJS_STATEMENTS[action] = "\(jQuery|$\)\\(#{RJS_ANY_ID}\\)\\.#{action}\\(\\)" end RJS_STATEMENTS[:any] = Regexp.new("(#{RJS_STATEMENTS.values.join('|')})") RJS_PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/ end end end end
Version data entries
6 entries across 6 versions & 1 rubygems