From 4b1985578a2b27b170358e82e72e00d23fdaf087 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Thu, 23 Aug 2012 21:59:22 +0300 Subject: correct handling of date selects when using both disabled and discard options we should take disabled option not only from `html_options` hash but from `options` hash too like `build_select` method does it. So datetime_select("post", "updated_at", { :discard_minute => true }, { :disabled => true }) datetime_select("post", "updated_at", :discard_minute => true , :disabled => true) both these variants work now closes #7431 --- actionpack/test/template/date_helper_test.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index 584d1830eb..cf707e1de5 100644 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -2533,6 +2533,30 @@ class DateHelperTest < ActionView::TestCase assert_dom_equal expected, datetime_select("post", "updated_at", :discard_minute => true) end + def test_datetime_select_disabled_and_discard_minute + @post = Post.new + @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) + + expected = %{\n" + expected << %{\n" + expected << %{\n" + + expected << " — " + + expected << %{\n" + expected << %{\n} + + assert_dom_equal expected, datetime_select("post", "updated_at", :discard_minute => true, :disabled => true) + end + def test_datetime_select_invalid_order @post = Post.new @post.updated_at = Time.local(2004, 6, 15, 15, 16, 35) -- cgit v1.2.3