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
129
129
130
130
invalid_templates =
131
131
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 }
134
134
. compact
135
135
. sort
136
136
137
137
unless invalid_templates . empty?
138
138
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 ) } " \
140
140
"#{ invalid_templates . map { |v | "'#{ v } '" } . to_sentence } in #{ component_class } . " \
141
141
"There can only be one template file per variant."
142
142
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
544
544
render_inline ( TooManySidecarFilesComponent . new )
545
545
end
546
546
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
+ )
548
551
end
549
552
550
553
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
555
558
556
559
assert_includes (
557
560
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"
559
564
)
560
565
end
561
566
@@ -594,7 +599,7 @@ def test_raise_error_when_template_file_and_sidecar_directory_template_exist
594
599
595
600
assert_includes (
596
601
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."
598
603
)
599
604
end
600
605
You can’t perform that action at this time.
0 commit comments