提交 fc547879 编写于 作者: S Sergey Nartimov

do not modify options in image_tag

上级 09200657
......@@ -355,8 +355,8 @@ def font_path(source)
# <img src="/images/mouse.png" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" alt="Mouse" />
# image_tag("mouse.png", :mouseover => image_path("mouse_over.png")) # =>
# <img src="/images/mouse.png" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" alt="Mouse" />
def image_tag(source, options = {})
options.symbolize_keys!
def image_tag(source, options={})
options = options.dup.symbolize_keys!
src = options[:src] = path_to_image(source)
......
......@@ -445,6 +445,12 @@ def test_image_tag
ImageLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }
end
def test_image_tag_does_not_modify_options
options = {:size => '16x10'}
image_tag('icon', options)
assert_equal({:size => '16x10'}, options)
end
def test_favicon_link_tag
FaviconLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) }
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册