Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert_select_jquery not working with space inside () #188

Open
respire opened this issue Mar 4, 2015 · 1 comment
Open

assert_select_jquery not working with space inside () #188

respire opened this issue Mar 4, 2015 · 1 comment

Comments

@respire
Copy link

respire commented Mar 4, 2015

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
@respire respire changed the title assert_select_jquery not working with space inside () or {} assert_select_jquery not working with space inside () Mar 4, 2015
@rafaelfranca
Copy link
Member

Could you open a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants