diff --git a/app/views/components/_translation-nav.html.erb b/app/views/components/_translation-nav.html.erb index 6d594694e..27b3e692a 100644 --- a/app/views/components/_translation-nav.html.erb +++ b/app/views/components/_translation-nav.html.erb @@ -1,13 +1,16 @@ -
- -
+<% translations ||= [] %> +<% if translations.length > 1 %> +
+ +
+<% end %> diff --git a/test/components/translation_nav_test.rb b/test/components/translation_nav_test.rb index 2566b2e8b..651496fc4 100644 --- a/test/components/translation_nav_test.rb +++ b/test/components/translation_nav_test.rb @@ -5,10 +5,21 @@ def component_name "translation-nav" end - test "fails to render a translation nav when no translations are given" do - assert_raise do - render_component({}) - end + test "renders nothing when no translations are given" do + assert_empty render_component({}) + end + + test "renders nothing when only one translation given" do + assert_empty render_component( + translations: [ + { + locale: 'en', + base_path: '/en', + text: 'English', + active: true + } + ] + ) end test "renders an active translation nav item with a text description" do