diff --git a/app/assets/stylesheets/sdg/goals/targets.scss b/app/assets/stylesheets/sdg/goals/targets.scss new file mode 100644 index 000000000..f4b061462 --- /dev/null +++ b/app/assets/stylesheets/sdg/goals/targets.scss @@ -0,0 +1,18 @@ +.sdg-goal-show .targets { + dt, + dd { + display: inline; + } + + dd { + + &::after { + content: ""; + display: block; + } + + &:not(:last-child)::after { + margin-bottom: $line-height / 2; + } + } +} diff --git a/app/components/sdg/goals/show_component.html.erb b/app/components/sdg/goals/show_component.html.erb index f1511ef83..fcc731887 100644 --- a/app/components/sdg/goals/show_component.html.erb +++ b/app/components/sdg/goals/show_component.html.erb @@ -34,4 +34,6 @@ <%= render ::Widget::Feeds::FeedComponent.new(processes_feed) %> <% end %> + + <%= render SDG::Goals::TargetsComponent.new(goal) %> diff --git a/spec/system/sdg/goals_spec.rb b/spec/system/sdg/goals_spec.rb index efbe28ab9..edf0f7e6b 100644 --- a/spec/system/sdg/goals_spec.rb +++ b/spec/system/sdg/goals_spec.rb @@ -117,5 +117,27 @@ describe "SDG Goals", :js do expect(page).to have_css("div.read-more a", text: "Read more about Life on Land", visible: :hidden) expect(page).to have_css("div.read-more a", text: "Read less about Life on Land") end + + scenario "has tab target section" do + create(:sdg_local_target, code: "15.1.1", title: "SDG local target sample text") + visit sdg_goal_path(15) + + within "#target_tabs" do + expect(page).to have_content "Targets" + expect(page).to have_content "Local targets" + end + + within ".tabs-content" do + expect(page).to have_content "15.1 By 2020, ensure the conservation, restoration and sustainable" + expect(page).not_to have_content "15.1.1 SDG local target sample text" + end + + click_link "Local targets" + + within ".tabs-content" do + expect(page).to have_content "15.1.1 SDG local target sample text" + expect(page).not_to have_content "15.1 By 2020, ensure the conservation, restoration and sustainable" + end + end end end