Skip to content

Commit

Permalink
Merge pull request #255 from lanzhiheng/bugfix/we-can-not-input-jquer…
Browse files Browse the repository at this point in the history
…y-code-without-semicolon

 Fix we can not input jquery code without semicolon.
  • Loading branch information
rafaelfranca authored Apr 23, 2018
2 parents 51a0a15 + 26b64ca commit 0cebc59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/jquery/assert_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions

PATTERN_HTML = "['\"]((\\\\\"|\\\\'|[^\"'])*)['\"]"
PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\);"
SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\)[;]?"

def assert_select_jquery(*args, &block)
jquery_method = args.first.is_a?(Symbol) ? args.shift : nil
Expand Down
5 changes: 5 additions & 0 deletions test/assert_select_jquery_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'ostruct'
require_relative 'test_helper'
require_relative '../lib/jquery/assert_select'

Expand All @@ -19,6 +20,9 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
$("#cart tr:not(.total_line) > *").remove();
$("[href|=\"val\"][href$=\"val\"][href^=\"val\"]").remove();
$("tr + td, li").remove();
// without semicolon
$("#browser_cart").hide("blind", 1000)
JS

setup do
Expand All @@ -28,6 +32,7 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
def test_target_as_receiver
assert_nothing_raised do
assert_select_jquery :show, :blind, '#card'
assert_select_jquery :hide, :blind, '#browser_cart'
assert_select_jquery :html, '#id' do
assert_select 'p', 'something'
end
Expand Down

0 comments on commit 0cebc59

Please sign in to comment.