diff --git a/spec/components/step_by_step_nav_spec.rb b/spec/components/step_by_step_nav_spec.rb index 535ac01876..acc687840c 100644 --- a/spec/components/step_by_step_nav_spec.rb +++ b/spec/components/step_by_step_nav_spec.rb @@ -253,4 +253,11 @@ def stepnav assert_select ".gem-c-step-nav[data-id='harold']" end + + it "adds ga4 attributes" do + render_component(steps: stepnav, ga4_tracking: true) + + assert_select ".gem-c-step-nav[data-ga4-show-all-attributes='{\"event_name\":\"select_content\",\"type\":\"step by step\",\"index\":0,\"index_total\":5}']" + assert_select "#{step1} .gem-c-step-nav__title .js-step-title[data-ga4='{\"event_name\":\"select_content\",\"type\":\"step by step\",\"text\":\"Step 1\",\"index\":1,\"index_total\":5}']" + end end diff --git a/spec/javascripts/components/step-by-step-nav-spec.js b/spec/javascripts/components/step-by-step-nav-spec.js index 90db6d6850..cbc72d79fa 100644 --- a/spec/javascripts/components/step-by-step-nav-spec.js +++ b/spec/javascripts/components/step-by-step-nav-spec.js @@ -4,9 +4,9 @@ describe('A stepnav module', function () { 'use strict' - var $element + var $element, element var html = - '