Include search term in title for improved accessibility (#14805)
* Include search term in title for improved accessibility * Update index.html.erb * update examples with correct description Co-authored-by: Michael Kohl <citizen428@forem.com>
This commit is contained in:
parent
a5e8ed66ee
commit
00c5af783e
2 changed files with 17 additions and 1 deletions
|
|
@ -19,7 +19,9 @@
|
|||
</div>
|
||||
|
||||
<div class="block s:flex items-center justify-between">
|
||||
<h1 class="crayons-title hidden s:block pl-2">Search results</h1>
|
||||
<h1 class="crayons-title hidden s:block pl-2">
|
||||
Search results <%= "for #{params[:q]}" unless params[:q].empty? %>
|
||||
</h1>
|
||||
|
||||
<nav id="sorting-option-tabs" aria-label="Search result sort options" class="-mx-3 m:mx-0">
|
||||
<ul class="crayons-navigation crayons-navigation--horizontal">
|
||||
|
|
|
|||
|
|
@ -6,5 +6,19 @@ RSpec.describe "Stories::ArticlesSearchController", type: :request do
|
|||
get "/search?q=hello"
|
||||
expect(response.body).to include("=> Search Results")
|
||||
end
|
||||
|
||||
context "with non-empty query" do
|
||||
it "renders search term in page title" do
|
||||
get "/search?q=hello"
|
||||
expect(response.body).to include("Search results for hello")
|
||||
end
|
||||
end
|
||||
|
||||
context "with empty query" do
|
||||
it "renders default page title" do
|
||||
get "/search?q="
|
||||
expect(response.body).to include("Search results\s")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue