aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_tag_helper_test.rb
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-12-23 22:43:46 +0330
committerJeremy Kemper <jeremy@bitsweat.net>2011-01-09 15:22:23 -0800
commit18605adec36f8487374d68cdb031e89e91379c56 (patch)
tree3f8e623e8ba22d824a77346ebb8c8ff941ec12d3 /actionpack/test/template/form_tag_helper_test.rb
parent2b2b50660b03c2c47b0cdee3544e7a82f26711d0 (diff)
downloadrails-18605adec36f8487374d68cdb031e89e91379c56.tar.gz
rails-18605adec36f8487374d68cdb031e89e91379c56.tar.bz2
rails-18605adec36f8487374d68cdb031e89e91379c56.zip
HTML5 button_tag helper
This tag is similar in nature to submit_tag, but allows more control. It also doesn't submit if submit type isn't used, allowing JavaScript to control the flow where required. For more information: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-button-element
Diffstat (limited to 'actionpack/test/template/form_tag_helper_test.rb')
-rw-r--r--actionpack/test/template/form_tag_helper_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb
index f3933a25b9..0d29b962d5 100644
--- a/actionpack/test/template/form_tag_helper_test.rb
+++ b/actionpack/test/template/form_tag_helper_test.rb
@@ -385,6 +385,34 @@ class FormTagHelperTest < ActionView::TestCase
)
end
+ def test_button_tag
+ assert_dom_equal(
+ %(<button name="button" type="button">Button</button>),
+ button_tag
+ )
+ end
+
+ def test_button_tag_with_submit_type
+ assert_dom_equal(
+ %(<button name="button" type="submit">Save</button>),
+ button_tag("Save", :type => "submit")
+ )
+ end
+
+ def test_button_tag_with_reset_type
+ assert_dom_equal(
+ %(<button name="button" type="reset">Reset</button>),
+ button_tag("Reset", :type => "reset")
+ )
+ end
+
+ def test_button_tag_with_disabled_option
+ assert_dom_equal(
+ %(<button name="button" type="reset" disabled="disabled">Reset</button>),
+ button_tag("Reset", :type => "reset", :disabled => true)
+ )
+ end
+
def test_image_submit_tag_with_confirmation
assert_dom_equal(
%(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />),