From 90a445acd663ad866513750751233d86debcd8b1 Mon Sep 17 00:00:00 2001 From: octopusinvitro Date: Thu, 22 Sep 2016 12:17:39 +0100 Subject: [PATCH 1/2] Use tidy-html5 to validate the home page Errors corrected: - Attribute "placeholder" not allowed on element "select" at this point. At line 86, column 189 - Attribute "autocorrect" not allowed on element "select" at this point. At line 86, column 189 - Attribute "autocomplete" not allowed on element "select" at this point. At line 86, column 189 --- t/web/basic.rb | 8 ++++++++ views/country_selector.erb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/t/web/basic.rb b/t/web/basic.rb index 258d99c96..cf2989340 100644 --- a/t/web/basic.rb +++ b/t/web/basic.rb @@ -66,4 +66,12 @@ last_response.status.must_equal 404 end end + + describe 'HTML validation' do + before { get '/' } + + it 'has no errors in the home page' do + last_response_must_be_valid + end + end end diff --git a/views/country_selector.erb b/views/country_selector.erb index 6315bcc5d..48aa4ed99 100644 --- a/views/country_selector.erb +++ b/views/country_selector.erb @@ -1,4 +1,4 @@ - <% @page.all_countries.each do |country| %> From 7377c5c6b2d57e2f9a4ffea393cbf54d63606408 Mon Sep 17 00:00:00 2001 From: octopusinvitro Date: Thu, 22 Sep 2016 15:09:58 +0100 Subject: [PATCH 2/2] Add placeholder back to the select through JavaScript. --- public/javascript/main.js | 28 +++++++++++++++++++--------- views/homepage.erb | 7 ++++++- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/public/javascript/main.js b/public/javascript/main.js index b44493b48..b2995e77b 100644 --- a/public/javascript/main.js +++ b/public/javascript/main.js @@ -461,15 +461,25 @@ $(function(){ }); // http://baymard.com/labs/country-selector - $('.js-select-to-autocomplete').selectToAutocomplete().on('change', function(){ - var v = $(this).val(); - if (v) { - // Assumes the