提交 f4eb2e23 编写于 作者: J Javan Makhmali

Fix digesting templates with mixed formats

上级 9d9f7526
......@@ -45,11 +45,9 @@ def logger
# Create a dependency tree for template named +name+.
def tree(name, finder, partial = false, seen = {})
logical_name = name.gsub(%r|/_|, "/")
finder.formats = [finder.rendered_format] if finder.rendered_format
options = {}
options[:formats] = [finder.rendered_format] if finder.rendered_format
if template = finder.disable_cache { finder.find_all(logical_name, [], partial, [], options).first }
if template = finder.disable_cache { finder.find_all(logical_name, [], partial, []).first }
finder.rendered_format ||= template.formats.first
if node = seen[template.identifier] # handle cycles in the tree
......
alert("<%=j render("comments/comment") %>")
......@@ -160,6 +160,18 @@ def test_template_formats_of_dependencies_with_same_logical_name_and_different_r
assert_equal [:html], tree_template_formats("messages/show").uniq
end
def test_template_dependencies_with_fallback_from_js_to_html_format
finder.rendered_format = :js
assert_equal ["comments/comment"], dependencies("comments/show")
end
def test_template_digest_with_fallback_from_js_to_html_format
finder.rendered_format = :js
assert_digest_difference("comments/show") do
change_template("comments/_comment")
end
end
def test_recursion_in_renders
assert digest("level/recursion") # assert recursion is possible
assert_not_nil digest("level/recursion") # assert digest is stored
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册