Skip to content

Commit

Permalink
CRIMAPP-1534 no empty cells (#789)
Browse files Browse the repository at this point in the history
* CRIMAPP-1534 add hidden text to empty cells

* Update to reflect renamed column

* Add hidden text when case type is missing
  • Loading branch information
timpeat authored Jan 15, 2025
1 parent 177a331 commit 0bf7e0a
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
6 changes: 6 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ def link_to_search_by_caseworker(user_name, user_id)
)
end

def no_data(colname)
column_name = t(colname, scope: 'table_headings')

govuk_visually_hidden(value_text(:no_data_for, column_name:))
end

def closed_action?(action_name)
action_name == 'closed'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
<%= result.application_type.humanize %>
</td>
<td class="govuk-table__cell">
<%= result.case_type&.humanize %>
<%= result.case_type&.humanize || no_data(:case_type) %>
</td>
<td class="govuk-table__cell">
<%= l(result.submitted_at) %>
</td>
<td class="govuk-table__cell">
<%= l(result.reviewed_at) if result.reviewed_at %>
<%= result.reviewed_at ? l(result.reviewed_at) : no_data(:reviewed_at) %>
</td>
<td class="govuk-table__cell">
<%= result.caseworker_name %>
<%= result.caseworker_name || no_data(:caseworker) %>
</td>
<td class="govuk-table__cell">
<%= t(result.review_status, scope: 'values.review_status') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/casework/base/_primary_navigation.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= govuk_service_navigation(navigation_id: 'example-5', current_path: request.path, classes: 'app-service-navigation') do |sn| %>
<%= govuk_service_navigation(current_path: request.path, classes: 'app-service-navigation') do |sn| %>
<%= sn.with_navigation_item(
text: t('primary_navigation.your_list', count: assignments_count),
href: assigned_applications_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<%= t('values.days_passed', count: app.days_passed) %>
</td>
<td class="govuk-table__cell">
<%= app.assignee_name %>
<%= app.assignee_name || no_data(:caseworker) %>
</td>
</tr>
1 change: 1 addition & 0 deletions config/locales/en/casework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ en:
no_one: no one
none: None
not_asked: Not asked when this application was submitted
no_data_for: No data exists for %{column_name}
not_provided: Not provided
post_submission_evidence: Post submission evidence
provider_address: Same as provider address
Expand Down
4 changes: 3 additions & 1 deletion spec/system/casework/open_applications_dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
Date.parse('2022-10-27'), Time.current.in_time_zone('London')
)

expect(first_row_text).to eq("Kit Pound 120398120 Initial 27 Oct 2022 #{days_ago} days")
expect(first_row_text).to eq(
"Kit Pound 120398120 Initial 27 Oct 2022 #{days_ago} days No data exists for Caseworker"
)
end

it 'receives the application if not already received' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,36 @@
it 'shows the correct results' do
first_row_text = page.first('.app-table tbody tr').text

expect(first_row_text).to eq('Kit Pound 120398120 Initial Summary only 27 Oct 2022 Open')
expect(first_row_text).to eq(
'Kit Pound 120398120 Initial Summary only 27 Oct 2022 ' \
'No data exists for Date closed No data exists for Caseworker Open'
)
end

context 'when result is PSE' do
let(:stubbed_search_results) do
[
ApplicationSearchResult.new(
applicant_name: 'Kit Pound',
resource_id: '21c37e3e-520f-46f1-bd1f-5c25ffc57d70',
reference: 120_398_120,
status: 'submitted',
work_stream: 'criminal_applications_team',
submitted_at: '2022-10-24T09:50:04.019Z',
parent_id: '696dd4fd-b619-4637-ab42-a5f4565bcf4a',
application_type: 'post_submission_evidence'
)
]
end

it 'shows the correct results' do
first_row_text = page.first('.app-table tbody tr').text

expect(first_row_text).to eq(
'Kit Pound 120398120 Post submission evidence No data exists for Case type ' \
'24 Oct 2022 No data exists for Date closed No data exists for Caseworker Open'
)
end
end

it 'has the correct search results count' do
Expand Down

0 comments on commit 0bf7e0a

Please sign in to comment.