Fixed TagHelper such that :name and 'name' keys in the options doesn't result...

Fixed TagHelper such that :name and 'name' keys in the options doesn't result in two attributes #1455 [take_tk]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1426 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 7bb48605
*SVN*
* Fixed TagHelper such that :name and 'name' keys in the options doesn't result in two attributes #1455 [take_tk]
* Ensure that helpers are only available to the controllers where they are defined and their subclasses. #1394 [kdole@tamu.edu]
* render("foo/bar") works with a layout again
......
......@@ -25,8 +25,7 @@ def content_tag(name, content, options = {})
private
def tag_options(options)
unless options.empty?
options.symbolize_keys
" " + options.map { |key, value|
" " + options.symbolize_keys.map { |key, value|
%(#{key}="#{html_escape(value.to_s)}")
}.sort.join(" ")
end
......
......@@ -12,6 +12,10 @@ def test_tag
assert_equal tag("p", "class" => "show"), tag("p", :class => "show")
end
def test_tag_options
assert_equal "<p class=\"elsewhere\" />", tag("p", "class" => "show", :class => "elsewhere")
end
def test_content_tag
assert_equal "<a href=\"create\">Create</a>", content_tag("a", "Create", "href" => "create")
assert_equal content_tag("a", "Create", "href" => "create"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册