ajout d'une bannière de dépréciation pour IE11

This commit is contained in:
clemkeirua 2020-07-01 22:11:53 +02:00
parent 440f8d6b71
commit ca74ae5a5e
3 changed files with 40 additions and 12 deletions

View file

@ -6,5 +6,5 @@ Opera >= 40
Safari >= 8 Safari >= 8
iOS >= 8 iOS >= 8
# Although IE 11 shows a deprecation banner, we still support the transpilation option. # Although IE 11 shows a deprecation banner, we still support the transpilation option.
# IE 11 support may be removed starting from 01 / 06 / 2020. # IE 11 support will be removed on Jan. 31st, 2021.
IE >= 11 IE >= 11

View file

@ -2,11 +2,19 @@
#outdated-browser-banner.site-banner #outdated-browser-banner.site-banner
.container .container
.site-banner-icon ⚠️ .site-banner-icon ⚠️
.site-banner-text - if browser.ie?(11)
%strong .site-banner-text
#{browser.name} #{browser.version} est trop ancien pour utiliser demarches-simplifiees.fr. Internet Explorer 11 est un navigateur trop ancien. Nous cesserons de gérer son fonctionnement à partir du
%br %strong
Certaines parties du site ne fonctionneront pas correctement. 31 janvier 2021.
%br
Merci de changer pour un navigateur plus récent avant cette date ; il peut être nécessaire de prendre contact avec un responsable informatique.
- else
.site-banner-text
%strong
#{browser.name} #{browser.version} est trop ancien pour utiliser demarches-simplifiees.fr.
%br
Certaines parties du site ne fonctionneront pas correctement.
.site-banner-actions .site-banner-actions
= button_to 'Ignorer', dismiss_outdated_browser_path, method: :post, remote: true, class: 'button btn', title: 'Ne plus afficher cet avertissement pendant une semaine' = button_to 'Ignorer', dismiss_outdated_browser_path, method: :post, remote: true, class: 'button btn', title: 'Ne plus afficher cet avertissement pendant une semaine'
%a.btn.button.primary{ href: "https://browser-update.org/fr/update.html", target: "_blank", rel: "noopener" } %a.btn.button.primary{ href: "https://browser-update.org/fr/update.html", target: "_blank", rel: "noopener" }

View file

@ -1,29 +1,49 @@
feature 'Outdated browsers support:' do feature 'Outdated browsers support:' do
context 'when the user browser is outdated' do context 'when the user browser is outdated' do
before(:each) do before(:each) do
ie_11_user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko' ie_10_user_agent = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C; InfoPath.3)'
Capybara.page.driver.header('user-agent', ie_11_user_agent) Capybara.page.driver.header('user-agent', ie_10_user_agent)
end end
scenario 'a banner is displayed' do scenario 'a banner is displayed' do
visit new_user_session_path visit new_user_session_path
expect(page).to have_content('Internet Explorer 11 est trop ancien') expect(page).to have_content('Internet Explorer 10 est trop ancien')
end end
scenario 'the banner can be dismissed' do scenario 'the banner can be dismissed' do
visit new_user_session_path visit new_user_session_path
expect(page).to have_content('Internet Explorer 11 est trop ancien') expect(page).to have_content('Internet Explorer 10 est trop ancien')
# The banner is hidden immediately # The banner is hidden immediately
within '#outdated-browser-banner' do within '#outdated-browser-banner' do
click_on 'Ignorer' click_on 'Ignorer'
end end
expect(page).not_to have_content('Internet Explorer 11 est trop ancien') expect(page).not_to have_content('Internet Explorer 10 est trop ancien')
expect(page).to have_current_path(new_user_session_path) expect(page).to have_current_path(new_user_session_path)
# The banner is hidden after a refresh # The banner is hidden after a refresh
page.refresh page.refresh
expect(page).not_to have_content('Internet Explorer 11 est trop ancien') expect(page).not_to have_content('Internet Explorer 10 est trop ancien')
end
end
context 'when the user browser is about to be outdated' do
before(:each) do
ie_11_user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'
Capybara.page.driver.header('user-agent', ie_11_user_agent)
end
scenario 'IE11 gets a dedicated depreciation banner for update before jan 31st 2021' do
visit new_user_session_path
expect(page).to have_content('31 janvier 2021')
expect(page).to have_content('Internet Explorer 11 est un navigateur trop ancien')
within '#outdated-browser-banner' do
click_on 'Ignorer'
end
page.refresh
expect(page).not_to have_content('Internet Explorer 11 est un navigateur trop ancien')
end end
end end
end end