Skip to content

Commit

Permalink
Adds unit tests to check that there are ARIA labels on the search but…
Browse files Browse the repository at this point in the history
…tons (#407)

* add aria-label to search button

* add aria-label to search-by-location button

* Add tests for ARIA labels on search buttons (splash page)
  • Loading branch information
DeeDeeG authored and tkwidmer committed Dec 27, 2017
1 parent be29a57 commit 7ec48d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/layouts/_search.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
.input-group
= text_field_tag :search, params[:search], class: "form-control search-bar", aria: {label: t("search_bar.enter_location")}
.input-group-btn
%button.btn.btn-light-purple.submit-search-button{type: "button", title: "Search", value: "Search"}
%button.btn.btn-light-purple.submit-search-button{type: "button", title: "Search", value: "Search", aria: { label: "Search" }}
%i.fa.fa-search.fa-2x
%i.fa.fa-refresh.fa-spin.fa-2x
%button.btn.btn-light-purple.current-location-button{type: "button", title: "Search by Current Location", value: (splash ? "Search Current Location" : nil ) }
%button.btn.btn-light-purple.current-location-button{type: "button", title: "Search by Current Location", aria: { label: "Search by Current Location" }, value: (splash ? "Search Current Location" : nil ) }
%i.fa.fa-location-arrow.fa-2x
%i.fa.fa-refresh.fa-spin.fa-2x
5 changes: 5 additions & 0 deletions features/search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ Feature: Search for restrooms
And I search from Vancouver
Then I should not see a restroom

Scenario: Search from splash page (screen reader accessibility check)
When I am on the splash page
Then the search buttons should have ARIA labels

Scenario: Map display
Given a restroom exists in Winnipeg
When I am on the splash page
And I search from Winnipeg
And I show the map
Then I should see a restroom on the map

5 changes: 5 additions & 0 deletions features/step_definitions/search_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@
mock_location location
find('.current-location-button').click
end

Then(/^the search buttons should have ARIA labels$/) do
expect(find('button.submit-search-button')['aria-label']).to be_truthy
expect(find('button.current-location-button')['aria-label']).to be_truthy
end

0 comments on commit 7ec48d2

Please sign in to comment.