Skip to content

Commit

Permalink
Merge pull request #8649 from alphagov/improve-accessibility-of-docum…
Browse files Browse the repository at this point in the history
…ent-search-results

Improve accessibility of search results
  • Loading branch information
lauraghiorghisor-tw authored Dec 20, 2023
2 parents ca06986 + dc590cc commit 3463eb8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
3 changes: 1 addition & 2 deletions app/views/admin/editions/_search_results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<p class="govuk-heading-s govuk-!-margin-bottom-3"><%= pluralize(number_with_delimiter(@filter.editions.total_count), "document") %></p>
<% end %>

<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible">

<% if filter.editions.blank? %>
<p class="govuk-body app-view-edition-search-results__no_documents">No documents found</p>
<% else %>
Expand Down Expand Up @@ -46,6 +44,7 @@
},
]
end,
first_cell_is_header: true,
} %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/editions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<%= render "filter_options", filter_action: admin_editions_path %>
</div>
<div class="govuk-grid-column-two-thirds">
<div class="app-view-edition-index__table">
<div class="app-view-edition-index__table" aria-label="Search results">
<%= render "search_results", filter: @filter, paginator: @filter.editions, show_export: true %>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
},
]
end,
first_cell_is_header: true,
} %>

<%= paginate(paginator, anchor: anchor, theme: "govuk_paginator") %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/shared/_featurable_editions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<%= render "admin/editions/filter_options", filter_by:, filter_action:, anchor: %>
</div>
<div class="govuk-grid-column-two-thirds">
<div class="app-view-features-search-results__table">
<div class="app-view-features-search-results__table" aria-label="Search results">
<%= render "admin/featurable_editions/search_results", featurable_editions:, paginator:, anchor:, feature_path: %>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
]
end,
first_cell_is_header: true,
} %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/statistics_announcements/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<%= render "filter_options" %>
</div>
<div class="govuk-grid-column-two-thirds">
<div class="app-view-edition-index__table">
<div class="app-view-edition-index__table" aria-label="Search results">
<%= render "search_results", filter: @filter, paginator: @statistics_announcements, show_export: true %>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions test/functional/admin/editions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Admin::EditionsControllerTest < ActionController::TestCase
get :index, params: { state: :published, type: :publication }

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: publication.title
assert_select ".govuk-table__header:nth-child(1)", text: publication.title
assert_select ".govuk-table__cell:nth-child(3)", text: "Published"
end
end
Expand All @@ -174,7 +174,7 @@ class Admin::EditionsControllerTest < ActionController::TestCase
get :index, params: { state: :published, type: :publication }

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: publication.title
assert_select ".govuk-table__header:nth-child(1)", text: publication.title
assert_select ".govuk-table__cell:nth-child(3)", text: "Force published"
end
end
Expand All @@ -184,7 +184,7 @@ class Admin::EditionsControllerTest < ActionController::TestCase
get :index, params: { state: :force_published, type: :publication }

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: publication.title
assert_select ".govuk-table__header:nth-child(1)", text: publication.title
assert_select ".govuk-table__cell:nth-child(3)", text: "Force published"
end
end
Expand All @@ -198,25 +198,25 @@ class Admin::EditionsControllerTest < ActionController::TestCase
get :index, params: { state: :active }

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: draft_edition.title do |cell|
assert_select ".govuk-table__header:nth-child(1)", text: draft_edition.title do |cell|
cell.first.parent.xpath("td[3]").text.strip == "Draft"
end
end

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: submitted_edition.title do |cell|
assert_select ".govuk-table__header:nth-child(1)", text: submitted_edition.title do |cell|
cell.first.parent.xpath("td[3]").text.strip == "Submitted"
end
end

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: rejected_edition.title do |cell|
assert_select ".govuk-table__header:nth-child(1)", text: rejected_edition.title do |cell|
cell.first.parent.xpath("td[3]").text.strip == "Rejected"
end
end

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: published_edition.title do |cell|
assert_select ".govuk-table__header:nth-child(1)", text: published_edition.title do |cell|
cell.first.parent.xpath("td[3]").text.strip == "Published"
end
end
Expand All @@ -236,9 +236,9 @@ class Admin::EditionsControllerTest < ActionController::TestCase
get :index, params: { state: :active }

accessible.each do |edition|
assert_select ".govuk-table__cell:nth-child(1)", text: edition.title
assert_select ".govuk-table__header:nth-child(1)", text: edition.title
end
refute_select ".govuk-table__cell:nth-child(1)", text: inaccessible.title
refute_select ".govuk-table__header:nth-child(1)", text: inaccessible.title
end

view_test "index should indicate the protected status of limited access editions which I do have access to" do
Expand All @@ -249,7 +249,7 @@ class Admin::EditionsControllerTest < ActionController::TestCase
get :index, params: { state: :active }

assert_select ".govuk-table__row" do
assert_select ".govuk-table__cell:nth-child(1)", text: publication.title
assert_select ".govuk-table__header:nth-child(1)", text: publication.title
assert_select ".govuk-table__cell:nth-child(3)", text: "Draft Limited access"
end
end
Expand Down

0 comments on commit 3463eb8

Please sign in to comment.