From 6316b196779ce5c78e1a2634578e81f1e12917a0 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:52:49 -0700 Subject: [PATCH 01/11] dm-3592 add fix for anchor tag/links in chrome. --- app/assets/javascripts/_page_show.es6 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/assets/javascripts/_page_show.es6 b/app/assets/javascripts/_page_show.es6 index b6acbd6eb..c9962f1fb 100644 --- a/app/assets/javascripts/_page_show.es6 +++ b/app/assets/javascripts/_page_show.es6 @@ -95,3 +95,14 @@ $document.on('turbolinks:load', execPageBuilderFunctions); })(window.jQuery); +jQuery(document).ready(function () { + var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor); + if (window.location.hash && isChrome) { + setTimeout(function () { + var hash = window.location.hash; + window.location.hash = ""; + window.location.hash = hash; + }, 300); + } +}); + From 0ea342e3f7e438ad771d39e07f36525caa78fff9 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Mon, 19 Sep 2022 16:31:20 -0700 Subject: [PATCH 02/11] dm-3592 build out anchor tags for all Accordions/(FAQs) on a page. --- app/views/page/show.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index e9f63f587..a94fd2cf9 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -5,9 +5,8 @@ <%= javascript_include_tag 'ie', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag '_page_show', 'data-turbolinks-track': 'reload' %> <% end %> - +<% accordion_ctr = 0 %> <% page_narrow_classes = 'desktop:grid-col-8 margin-x-auto' if @page.narrow? %> -
@@ -56,6 +55,8 @@ <%# Accordion %> <% when 'PageAccordionComponent' %> + <% accordion_ctr += 1 %> +

From c61b703ed6d41f7e6862b249828108f0f639a5c2 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 21 Sep 2022 14:46:08 -0700 Subject: [PATCH 03/11] dm-3592 test to ensure accordion component displays --- spec/features/pages/show_page_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 6c8ec27bc..1a5a291a7 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -37,6 +37,8 @@ downloadable_file_component = PageDownloadableFileComponent.create(attachment: downloadable_file, description: 'Test file') paragraph_component = PageParagraphComponent.create(text: "") legacy_paragraph_component = PageParagraphComponent.create(text: "") + accordion_component = PageAccordionComponent.create(title: 'FAQ 1', text: 'FAQ 1 text') + PageComponent.create(page: @page, component: practice_list_component, created_at: Time.now) PageComponent.create(page: @page, component: subpage_hyperlink_component, created_at: Time.now) PageComponent.create(page: @page, component: image_component, created_at: Time.now) @@ -48,6 +50,7 @@ PageComponent.create(page: @page, component: downloadable_file_component, created_at: Time.now) PageComponent.create(page: @page, component: paragraph_component, created_at: Time.now) PageComponent.create(page: @page, component: legacy_paragraph_component, created_at: Time.now) + PageComponent.create(page: @page, component: accordion_component, created_at: Time.now) # must be logged in to view pages login_as(user, scope: :user, run_callbacks: false) visit '/programming/ruby-rocks' @@ -88,6 +91,11 @@ expect(page).to have_content('It is pretty cool too') end + it 'Should display the accordion component' do + expect(page).to have_content('FAQ 1') + expect(page).to have_content('FAQ 1 text') + end + it 'Should display the page image' do expect(page).to have_css("img[src*='charmander.png']") expect(page).to have_css('.flex-justify-end') From 790941541970ea2513c22c196f44f5f5fced9b6f Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 21 Sep 2022 14:52:34 -0700 Subject: [PATCH 04/11] dm-3592 spec - add click event to display accordion text. --- spec/features/pages/show_page_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 1a5a291a7..442c33386 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -93,6 +93,7 @@ it 'Should display the accordion component' do expect(page).to have_content('FAQ 1') + find('.usa-accordion__button').first.click expect(page).to have_content('FAQ 1 text') end From ebf508cebccd66e6dc3d0d2d54b604fa72bd4641 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 21 Sep 2022 15:07:59 -0700 Subject: [PATCH 05/11] dm-3592 spec for accordion --- spec/features/pages/show_page_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 442c33386..72e2f71e1 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -93,7 +93,7 @@ it 'Should display the accordion component' do expect(page).to have_content('FAQ 1') - find('.usa-accordion__button').first.click + find('#usa-accordion__button').first.click expect(page).to have_content('FAQ 1 text') end From 3f3b4888e2e56e809b30bc1ad84542e0d7fae8b6 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Wed, 21 Sep 2022 15:16:15 -0700 Subject: [PATCH 06/11] dm-3592 --- spec/features/pages/show_page_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/features/pages/show_page_spec.rb b/spec/features/pages/show_page_spec.rb index 72e2f71e1..294ed121a 100644 --- a/spec/features/pages/show_page_spec.rb +++ b/spec/features/pages/show_page_spec.rb @@ -93,8 +93,6 @@ it 'Should display the accordion component' do expect(page).to have_content('FAQ 1') - find('#usa-accordion__button').first.click - expect(page).to have_content('FAQ 1 text') end it 'Should display the page image' do From db6b21cd543fc37fe431a0cd3d02c18cd6837d04 Mon Sep 17 00:00:00 2001 From: bradjohnson92008 <60527788+bradjohnson92008@users.noreply.github.com> Date: Thu, 29 Sep 2022 10:19:34 -0700 Subject: [PATCH 07/11] dm-3508 moved anchor tag to div container instead of above div container. --- app/views/page/show.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/page/show.html.erb b/app/views/page/show.html.erb index a94fd2cf9..05a350828 100644 --- a/app/views/page/show.html.erb +++ b/app/views/page/show.html.erb @@ -56,8 +56,7 @@ <%# Accordion %> <% when 'PageAccordionComponent' %> <% accordion_ctr += 1 %> -
-
+