Merge pull request #153 from georgeclaghorn/method-calls-with-whitespace

Allow whitespace before method call in assert_select_jquery
This commit is contained in:
Rafael Mendonça França
2014-09-01 21:43:15 -03:00

View File

@@ -52,7 +52,7 @@ module Jquery
jquery_opt = args.first.is_a?(Symbol) ? args.shift : nil
id = args.first.is_a?(String) ? args.shift : nil
pattern = "\\.#{jquery_method || '\\w+'}\\("
pattern = "\\s*\\.#{jquery_method || '\\w+'}\\("
pattern = "#{pattern}['\"]#{jquery_opt}['\"],?\\s*" if jquery_opt
pattern = "#{pattern}#{PATTERN_HTML}"
pattern = "(?:jQuery|\\$)\\(['\"]#{id}['\"]\\)#{pattern}" if id