From 72f93b581f1d1a7496ccebbd90578714c171c5a5 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 19 Jun 2008 22:03:27 -0700 Subject: Check whether blocks are called from erb using a special __in_erb_template variable visible in block binding. --- actionpack/test/template/form_tag_helper_test.rb | 33 +++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'actionpack/test/template/form_tag_helper_test.rb') diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 47b3605849..eabbe9c8a0 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -35,21 +35,23 @@ class FormTagHelperTest < ActionView::TestCase expected = %(
) assert_dom_equal expected, actual end - + def test_form_tag_with_method_delete actual = form_tag({}, { :method => :delete }) expected = %(
) assert_dom_equal expected, actual end - def test_form_tag_with_block + def test_form_tag_with_block_in_erb + __in_erb_template = '' form_tag("http://example.com") { concat "Hello world!" } expected = %(Hello world!
) assert_dom_equal expected, output_buffer end - def test_form_tag_with_block_and_method + def test_form_tag_with_block_and_method_in_erb + __in_erb_template = '' form_tag("http://example.com", :method => :put) { concat "Hello world!" } expected = %(
Hello world!
) @@ -88,11 +90,11 @@ class FormTagHelperTest < ActionView::TestCase actual = radio_button_tag("gender", "m") + radio_button_tag("gender", "f") expected = %() assert_dom_equal expected, actual - + actual = radio_button_tag("opinion", "-1") + radio_button_tag("opinion", "1") expected = %() assert_dom_equal expected, actual - + actual = radio_button_tag("person[gender]", "m") expected = %() assert_dom_equal expected, actual @@ -103,13 +105,13 @@ class FormTagHelperTest < ActionView::TestCase expected = %() assert_dom_equal expected, actual end - + def test_select_tag_with_multiple actual = select_tag "colors", "", :multiple => :true expected = %() assert_dom_equal expected, actual end - + def test_select_tag_disabled actual = select_tag "places", "", :disabled => :true expected = %() @@ -145,37 +147,37 @@ class FormTagHelperTest < ActionView::TestCase expected = %() assert_dom_equal expected, actual end - + def test_text_field_tag_size_symbol actual = text_field_tag "title", "Hello!", :size => 75 expected = %() assert_dom_equal expected, actual end - + def test_text_field_tag_size_string actual = text_field_tag "title", "Hello!", "size" => "75" expected = %() assert_dom_equal expected, actual end - + def test_text_field_tag_maxlength_symbol actual = text_field_tag "title", "Hello!", :maxlength => 75 expected = %() assert_dom_equal expected, actual end - + def test_text_field_tag_maxlength_string actual = text_field_tag "title", "Hello!", "maxlength" => "75" expected = %() assert_dom_equal expected, actual end - + def test_text_field_disabled actual = text_field_tag "title", "Hello!", :disabled => :true expected = %() assert_dom_equal expected, actual end - + def test_text_field_tag_with_multiple_options actual = text_field_tag "title", "Hello!", :size => 70, :maxlength => 80 expected = %() @@ -226,12 +228,13 @@ class FormTagHelperTest < ActionView::TestCase submit_tag("Save", :confirm => "Are you sure?") ) end - + def test_pass assert_equal 1, 1 end - def test_field_set_tag + def test_field_set_tag_in_erb + __in_erb_template = '' field_set_tag("Your details") { concat "Hello world!" } expected = %(
Your detailsHello world!
) -- cgit v1.2.3 From 7378e237342443addb1691795ac9457250b6db1e Mon Sep 17 00:00:00 2001 From: Scott Stewart Date: Wed, 2 Jul 2008 01:36:58 +0100 Subject: Ensure proper output when submit_tag is used with :disabled_with. [#388 state:resolved] Signed-off-by: Pratik Naik --- actionpack/test/template/form_tag_helper_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack/test/template/form_tag_helper_test.rb') diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index eabbe9c8a0..4e4102aec7 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -222,6 +222,13 @@ class FormTagHelperTest < ActionView::TestCase ) end + def test_submit_tag_with_no_onclick_options + assert_dom_equal( + %(), + submit_tag("Save", :disable_with => "Saving...") + ) + end + def test_submit_tag_with_confirmation assert_dom_equal( %(), -- cgit v1.2.3