diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/assert_select_test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb index abeee689f4..bed8da622d 100644 --- a/actionpack/test/controller/assert_select_test.rb +++ b/actionpack/test/controller/assert_select_test.rb @@ -340,6 +340,33 @@ class AssertSelectTest < Test::Unit::TestCase assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" } end + def test_assert_select_rjs_for_chained_replace + render_rjs do |page| + page['test1'].replace "<div id=\"1\">foo</div>" + page['test2'].replace_html "<div id=\"2\">foo</div>" + page.insert_html :top, "test3", "<div id=\"3\">foo</div>" + end + # Replace. + assert_select_rjs :chained_replace do + assert_select "div", 1 + assert_select "#1" + end + assert_select_rjs :chained_replace, "test1" do + assert_select "div", 1 + assert_select "#1" + end + assert_raises(AssertionFailedError) { assert_select_rjs :chained_replace, "test2" } + # Replace HTML. + assert_select_rjs :chained_replace_html do + assert_select "div", 1 + assert_select "#2" + end + assert_select_rjs :chained_replace_html, "test2" do + assert_select "div", 1 + assert_select "#2" + end + assert_raises(AssertionFailedError) { assert_select_rjs :replace_html, "test1" } + end def test_assert_select_rjs_for_insert render_rjs do |page| |