File tree Expand file tree Collapse file tree 4 files changed +21
-6
lines changed
app/components/sub_templates_component Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -129,14 +129,14 @@ def template_errors
129129
130130 invalid_templates =
131131 templates
132- . group_by { |template | template [ :variant ] }
133- . map { |variant , grouped | variant if grouped . length > 1 }
132+ . group_by { |template | template [ :variant ] . present? ? " #{ template [ :base_name ] } + #{ template [ :variant ] } " : template [ :base_name ] }
133+ . map { |template , grouped | template if grouped . length > 1 }
134134 . compact
135135 . sort
136136
137137 unless invalid_templates . empty?
138138 errors <<
139- "More than one template found for #{ "variant " . pluralize ( invalid_templates . count ) } " \
139+ "More than one template+variant found for #{ "template " . pluralize ( invalid_templates . count ) } " \
140140 "#{ invalid_templates . map { |v | "'#{ v } '" } . to_sentence } in #{ component_class } . " \
141141 "There can only be one template file per variant."
142142 end
Original file line number Diff line number Diff line change 1+ <%# locals: (number:) %>
2+ < ol data-number ="<%= number %> ">
3+ <% @items . each do |item | %>
4+ < li > <%= item %> </ li >
5+ <% end %>
6+ </ ol >
Original file line number Diff line number Diff line change 1+ < div class ="container ">
2+ <%= render_summary_template string : string %>
3+ <%= render_ordered_list_template number : number %>
4+ </ div >
Original file line number Diff line number Diff line change @@ -544,7 +544,10 @@ def test_raises_error_when_more_than_one_sidecar_template_is_present
544544 render_inline ( TooManySidecarFilesComponent . new )
545545 end
546546
547- assert_includes error . message , "More than one template found for TooManySidecarFilesComponent."
547+ assert_includes (
548+ error . message ,
549+ "More than one template+variant found for template 'too_many_sidecar_files_component' in TooManySidecarFilesComponent."
550+ )
548551 end
549552
550553 def test_raises_error_when_more_than_one_sidecar_template_for_a_variant_is_present
@@ -555,7 +558,9 @@ def test_raises_error_when_more_than_one_sidecar_template_for_a_variant_is_prese
555558
556559 assert_includes (
557560 error . message ,
558- "More than one template found for variants 'test' and 'testing' in TooManySidecarFilesForVariantComponent"
561+ "More than one template+variant found for templates " \
562+ "'too_many_sidecar_files_for_variant_component+test' and 'too_many_sidecar_files_for_variant_component+testing' " \
563+ "in TooManySidecarFilesForVariantComponent"
559564 )
560565 end
561566
@@ -594,7 +599,7 @@ def test_raise_error_when_template_file_and_sidecar_directory_template_exist
594599
595600 assert_includes (
596601 error . message ,
597- "More than one template found for TemplateAndSidecarDirectoryTemplateComponent."
602+ "More than one template+variant found for template 'template_and_sidecar_directory_template_component' in TemplateAndSidecarDirectoryTemplateComponent."
598603 )
599604 end
600605
You can’t perform that action at this time.
0 commit comments