Add Targets component to Show component

This commit is contained in:
taitus
2021-01-27 20:00:55 +01:00
committed by Javi Martín
parent 857a6aa228
commit f45bbb316c
3 changed files with 42 additions and 0 deletions

View File

@@ -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;
}
}
}

View File

@@ -34,4 +34,6 @@
<%= render ::Widget::Feeds::FeedComponent.new(processes_feed) %> <%= render ::Widget::Feeds::FeedComponent.new(processes_feed) %>
</div> </div>
<% end %> <% end %>
<%= render SDG::Goals::TargetsComponent.new(goal) %>
</div> </div>

View File

@@ -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 more about Life on Land", visible: :hidden)
expect(page).to have_css("div.read-more a", text: "Read less about Life on Land") expect(page).to have_css("div.read-more a", text: "Read less about Life on Land")
end 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
end end