Skip to content

Commit

Permalink
Empty state for important notices
Browse files Browse the repository at this point in the history
  • Loading branch information
benilovj committed Oct 17, 2024
1 parent 9ae1c59 commit 7fa583f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/views/notices/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<%= h1 t("notices.index.title"), size: "xl" %>
<%= render AppNoticesTableComponent.new(deceased_patients: @deceased_patients) %>
<% if @deceased_patients.any? %>
<%= render AppNoticesTableComponent.new(deceased_patients: @deceased_patients) %>
<% else %>
<p class="nhsuk-body"><%= t("notices.index.no_results") %></p>
<% end %>
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ en:
notices:
index:
title: Important notices
no_results: There are currently no important notices.
mailers:
consent_form_mailer:
reasons_for_refusal:
Expand Down
13 changes: 11 additions & 2 deletions spec/features/manage_children_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@

scenario "Viewing important notices" do
given_my_team_exists
and_a_deceased_patient_exists

when_i_click_on_notices
then_i_see_no_notices

when_a_deceased_patient_exists
and_i_click_on_notices
then_i_see_the_notice_of_date_of_death
end

Expand All @@ -29,7 +32,7 @@ def and_patients_exist
create_list(:patient, 9, team: @team)
end

def and_a_deceased_patient_exists
def when_a_deceased_patient_exists
@deceased_patient = create(:patient, :deceased, team: @team)
end

Expand Down Expand Up @@ -60,6 +63,12 @@ def when_i_click_on_notices
click_on "Notices"
end

alias_method :and_i_click_on_notices, :when_i_click_on_notices

def then_i_see_no_notices
expect(page).to have_content("There are currently no important notices.")
end

def then_i_see_the_notice_of_date_of_death
expect(page).to have_content(@deceased_patient.full_name)
expect(page).to have_content("Record updated with child’s date of death")
Expand Down

0 comments on commit 7fa583f

Please sign in to comment.