mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix assert_select_rjs not checking id for inserts [#540 state:resolved]
This commit is contained in:
parent
d7b6e48c70
commit
dce0da77e7
2 changed files with 9 additions and 0 deletions
|
@ -402,6 +402,7 @@ module ActionController
|
||||||
if rjs_type
|
if rjs_type
|
||||||
if rjs_type == :insert
|
if rjs_type == :insert
|
||||||
position = args.shift
|
position = args.shift
|
||||||
|
id = args.shift
|
||||||
insertion = "insert_#{position}".to_sym
|
insertion = "insert_#{position}".to_sym
|
||||||
raise ArgumentError, "Unknown RJS insertion type #{position}" unless RJS_STATEMENTS[insertion]
|
raise ArgumentError, "Unknown RJS insertion type #{position}" unless RJS_STATEMENTS[insertion]
|
||||||
statement = "(#{RJS_STATEMENTS[insertion]})"
|
statement = "(#{RJS_STATEMENTS[insertion]})"
|
||||||
|
|
|
@ -248,6 +248,14 @@ class AssertSelectTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_assert_select_rjs_for_positioned_insert_should_fail_when_mixing_arguments
|
||||||
|
render_rjs do |page|
|
||||||
|
page.insert_html :top, "test1", "<div id=\"1\">foo</div>"
|
||||||
|
page.insert_html :bottom, "test2", "<div id=\"2\">foo</div>"
|
||||||
|
end
|
||||||
|
assert_raises(Assertion) {assert_select_rjs :insert, :top, "test2"}
|
||||||
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test css_select.
|
# Test css_select.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue