File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 15
15
<% if brexit_link %>
16
16
< div class ="govuk-body-l govuk-!-margin-bottom-7 ">
17
17
< p class ="govuk-body ">
18
- <%= I18n . t ( "brexit.heading_prefix" ) %> <%= link_to brexit_link [ :text ] , brexit_link [ :path ] %> .
18
+ <%= I18n . t ( "brexit.heading_prefix" ) %>
19
+ <%= link_to (
20
+ brexit_link [ :text ] ,
21
+ brexit_link [ :path ] ,
22
+ class : "govuk-link" ,
23
+ data : {
24
+ track_action : brexit_link [ :path ] ,
25
+ track_category : brexit_link [ :track_category ] ,
26
+ track_label : brexit_link [ :text ] ,
27
+ module : 'gem-track-click' ,
28
+ } ) %> .
19
29
</ p >
20
30
</ div >
21
31
<% else %>
Original file line number Diff line number Diff line change @@ -112,13 +112,22 @@ class DetailedGuideTest < ActionDispatch::IntegrationTest
112
112
link_text = "Brexit guidance for businesses"
113
113
assert page . has_link? ( link_text , href : ContentItem ::BrexitHubPage ::BREXIT_BUSINESS_PAGE_PATH )
114
114
115
- # adds GA tracking to the links
115
+ # adds GA tracking to the li links
116
116
track_action = find_link ( "Foreign travel advice" ) [ "data-track-action" ]
117
117
track_category = find_link ( "Foreign travel advice" ) [ "data-track-category" ]
118
118
track_label = find_link ( "Foreign travel advice" ) [ "data-track-label" ]
119
119
120
120
assert_equal "/foreign-travel-advice" , track_action
121
121
assert_equal "brexit-citizen-page" , track_category
122
122
assert_equal "Travel to the EU" , track_label
123
+
124
+ # adds GA tracking to the description field links
125
+ track_action = find_link ( "Brexit guidance for businesses" ) [ "data-track-action" ]
126
+ track_category = find_link ( "Brexit guidance for businesses" ) [ "data-track-category" ]
127
+ track_label = find_link ( "Brexit guidance for businesses" ) [ "data-track-label" ]
128
+
129
+ assert_equal ContentItem ::BrexitHubPage ::BREXIT_BUSINESS_PAGE_PATH , track_action
130
+ assert_equal "brexit-citizen-page" , track_category
131
+ assert_equal "Brexit guidance for businesses" , track_label
123
132
end
124
133
end
You can’t perform that action at this time.
0 commit comments