Skip to content

Commit 5f1781f

Browse files
Ada 748 (#8)
* ADA-748 element labels * changed title in header * changed test to accommodate view changes * fixed rubocop issue * changed rspec error for undefined method * disabled RSpec/ExampleLength: in spec
1 parent 4d4f6f1 commit 5f1781f

6 files changed

Lines changed: 19 additions & 14 deletions

File tree

app/views/layouts/application.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>Early Arrivals Search (EARS)</title>
4+
<title>Early Arrivals Records Search (EARS)</title>
55
<%= stylesheet_link_tag :application %>
66
<%= csrf_meta_tags %>
77
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

app/views/search_casefiles/_form.html.erb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<%= form_for(@searchcase, :html => { :multipart => true }) do |f| %>
22

3-
<p>
4-
<%= f.label :searchterm, "Enter query:" %><br />
5-
<%= f.text_field :LASTNAME %><br />
6-
</p>
3+
<p>
4+
<%= f.label :LASTNAME do %>
5+
Enter query:<br />
6+
<%= f.text_field :LASTNAME, placeholder: 'Enter a last name' %>
7+
<% end %>
8+
</p>
79

810

911
<%= f.submit %>

app/views/searchcase/display.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<h3>Immigration record:</h3>
55
<%= form_tag(action="/searchcase/display", method: "get") do %>
66
<%= label_tag(:q, 'Search records') %>
7-
<%= text_field_tag(:q, params[:q], aria: { label: 'Search immigration records' }) %>
7+
<%= text_field_tag(:q, params[:q], placeholder: 'Enter a name to search', aria: { label: 'Search immigration records' }) %>
88
<%= submit_tag("Search", :class => "search-bar") %>
99
<% end %>
1010
</div>
1111

1212
<%= will_paginate @return %>
1313
<table id='table'>
14-
<caption>Search results for immigration records</caption>
14+
<caption>Search results for immigration records</caption>
1515
<thead>
1616
<tr>
1717
<th class="record_col" scope="col">Last Name</th>

app/views/searchcase/search.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h3>Immigration record:</h3>
33
<%= form_tag(action="/searchcase/display", method: "get") do %>
44
<%= label_tag(:q, 'Search records') %>
5-
<%= text_field_tag(:q, params[:q], aria: { label: 'Search immigration records' }) %>
5+
<%= text_field_tag(:q, params[:q], placeholder: 'Enter a name to search', aria: { label: 'Search immigration records' }) %>
66
<%= submit_tag("Search", :class => "search-bar") %>
77
<% end %>
88

spec/controllers/application_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
describe '#index' do
88
it 'renders the index template' do
99
get :index
10-
expect(response.body).to match(/Early Arrivals Search/)
10+
expect(response.body).to match(/Early Arrivals Records Search/)
1111
end
1212
end
1313
end

spec/search_spec.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,16 @@ def generate_test_object
3838
scenario 'empty search shows all results' do # rubocop:disable RSpec/ExampleLength
3939
visit '/'
4040
click_button 'Search'
41-
expect(page).to have_content(
42-
'Last Name First Name Middle Name Age Gender ' \
43-
'Port Date Ship Destination LASTNAME FIRSTNAME'
44-
)
41+
expect(page).to satisfy do |current_page|
42+
current_page.has_content?(
43+
'Search results for immigration records Last Name First Name Middle Name Age Gender Port Date Ship Destination'
44+
) && current_page.has_css?('table#table tbody tr')
45+
end
4546
end
4647

4748
scenario 'Search query yields intended results' do
4849
visit '/'
49-
find('#q').set('DOG')
50+
find('#q').set('ZZZQUNOMATCH12345')
5051
click_button 'Search'
5152
expect(page).to have_content('query returned 0 results')
5253
end
@@ -55,13 +56,15 @@ def generate_test_object
5556
context 'when viewing record display', type: :feature do
5657
scenario 'Display Shows intended view' do
5758
visit '/'
59+
find('#q').set('LASTNAME')
5860
click_button 'Search'
5961
first(:link, 'LASTNAME').click
6062
expect(page).to have_content('Record details below')
6163
end
6264

6365
scenario 'Display Shows intended footer' do
6466
visit '/'
67+
find('#q').set('LASTNAME')
6568
click_button 'Search'
6669
first(:link, 'LASTNAME').click
6770
expect(page).to have_content('© University of California Regents. All rights reserved')

0 commit comments

Comments
 (0)