jquery-rails
jquery-rails copied to clipboard
assert_select_jquery not working with space inside ()
Example
in js
$( "#cart" ).html( "<%= escape_javascript render(@cart) %>" );
in test
assert_select_jquery :html, '#cart' do
# some codes
end
result in
No JQuery call matches [:html, "#cart"]
Related code
(lib/jquery/assert_select.rb:53)
pattern = "\\s*\\.#{jquery_method || '\\w+'}\\("
(lib/jquery/assert_select.rb:56)
pattern = "(?:jQuery|\\$)\\(['\"]#{id}['\"]\\)#{pattern}" if id
My Solution ( add "\s?" )
(lib/jquery/assert_select.rb:53)
pattern = "\\s*\\.#{jquery_method || '\\w+'}\\(\\s?"
(lib/jquery/assert_select.rb:56)
pattern = "(?:jQuery|\\$)\\(\\s?['\"]#{id}['\"]\\s?\\)#{pattern}" if id
Could you open a PR?