Skip to content

Commit 0cebc59

Browse files
authored
Merge pull request #255 from lanzhiheng/bugfix/we-can-not-input-jquery-code-without-semicolon
Fix we can not input jquery code without semicolon.
2 parents 51a0a15 + 26b64ca commit 0cebc59

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/jquery/assert_select.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
4949

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

5454
def assert_select_jquery(*args, &block)
5555
jquery_method = args.first.is_a?(Symbol) ? args.shift : nil

test/assert_select_jquery_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require 'ostruct'
12
require_relative 'test_helper'
23
require_relative '../lib/jquery/assert_select'
34

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

2428
setup do
@@ -28,6 +32,7 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
2832
def test_target_as_receiver
2933
assert_nothing_raised do
3034
assert_select_jquery :show, :blind, '#card'
35+
assert_select_jquery :hide, :blind, '#browser_cart'
3136
assert_select_jquery :html, '#id' do
3237
assert_select 'p', 'something'
3338
end

0 commit comments

Comments
 (0)