Skip to content

Why we must have semicolon #252

@lanzhiheng

Description

@lanzhiheng

I use assert_select_jquery to test my code and I debug the gem I get this pattern

   77:     patterns << argumentless_pattern unless jquery_opt
   78:
   79:     matched_pattern = nil
   80:     patterns.each do |pattern|
   81:       debugger
=> 82:       if response.body.match(Regexp.new(pattern))
   83:         matched_pattern = pattern
   84:         break
   85:       end
   86:     end
(byebug) pattern
"(?:jQuery|\\$)\\(['\"]#cart['\"]\\)\\.html\\(['\"]((\\\\\"|[^\"])*)['\"]\\);"

The pattern content the ; , So my code never pass the test.

$('#cart').html("<%=j render(@cart) %>")

If I add the ; to it , it can pass the test.

$('#cart').html("<%=j render(@cart) %>");

I think the ; in the pattern should be optional, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions