Skip to content

Commit

Permalink
Update tracking tests
Browse files Browse the repository at this point in the history
Remove `section` and `action` from test cases.
  • Loading branch information
dnkrj committed Nov 6, 2024
1 parent ea2b165 commit 11556df
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('GOVUK.analyticsGa4.analyticsModules', function () {
ga4ButtonSetup.init()

expect(button.dataset.ga4Event).toEqual(
'{"event_name":"navigation","type":"button","text":"Button","section":"Title","action":"Button","method":"primary_click"}'
'{"event_name":"navigation","type":"button","text":"Button","method":"primary_click"}'
)
})

Expand All @@ -29,7 +29,7 @@ describe('GOVUK.analyticsGa4.analyticsModules', function () {
ga4ButtonSetup.init()

expect(button.dataset.ga4Event).toEqual(
'{"event_name":"navigation","type":"button","text":"Button","section":"Title","action":"Button","method":"primary_click"}'
'{"event_name":"navigation","type":"button","text":"Button","method":"primary_click"}'
)
})

Expand All @@ -42,7 +42,7 @@ describe('GOVUK.analyticsGa4.analyticsModules', function () {
ga4ButtonSetup.init()

expect(button.dataset.ga4Event).toEqual(
'{"event_name":"custom_event_name","type":"button","text":"Button","section":"Title","action":"Button","method":"primary_click"}'
'{"event_name":"custom_event_name","type":"button","text":"Button","method":"primary_click"}'
)
})

Expand All @@ -56,7 +56,7 @@ describe('GOVUK.analyticsGa4.analyticsModules', function () {
ga4ButtonSetup.init()

expect(link.dataset.ga4Event).toEqual(
'{"event_name":"navigation","type":"button","text":"Link","section":"Title","action":"Link","method":"primary_click"}'
'{"event_name":"navigation","type":"button","text":"Link","method":"primary_click"}'
)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('GOVUK.analyticsGa4.analyticsModules.Ga4FormSetup', function () {
Ga4FormSetup.init()

expect(container.dataset.ga4Form).toEqual(
'{"event_name":"form_response","section":"Title","action":"button"}'
'{"event_name":"form_response","action":"button"}'
)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('GOVUK.analyticsGa4.analyticsModules.Ga4LinkSetup', function () {
Ga4LinkSetup.init()

expect(link.dataset.ga4Event).toEqual(
'{"event_name":"navigation","type":"generic_link","section":"Title","method":"primary_click"}'
'{"event_name":"navigation","type":"generic_link","method":"primary_click"}'
)
})

Expand All @@ -28,7 +28,7 @@ describe('GOVUK.analyticsGa4.analyticsModules.Ga4LinkSetup', function () {
Ga4LinkSetup.init()

expect(link.dataset.ga4Event).toEqual(
'{"event_name":"navigation","type":"button","section":"Title","method":"primary_click"}'
'{"event_name":"navigation","type":"button","method":"primary_click"}'
)
})
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
describe('GOVUK.analyticsGa4.analyticsModules.Ga4VisualEditorEventHandlers', function () {
it('triggers ga4 tracking on visualEditorSelectChange event', function () {
document.title = 'Title - Text'
const container = document.createElement('div')
const select = document.createElement('select')
container.setAttribute('data-module', 'ga4-visual-editor-event-handlers')
Expand Down Expand Up @@ -28,8 +27,6 @@ describe('GOVUK.analyticsGa4.analyticsModules.Ga4VisualEditorEventHandlers', fun
event_name: 'select_content',
type: 'select',
text: 'DROPDOWN',
section: 'Title',
action: 'DROPDOWN',
tool_name: 'Visual Editor'
}

Expand All @@ -40,7 +37,6 @@ describe('GOVUK.analyticsGa4.analyticsModules.Ga4VisualEditorEventHandlers', fun
})

it('triggers ga4 tracking on visualEditorButtonClick event', function () {
document.title = 'Title - Text'
const container = document.createElement('div')
const button = document.createElement('button')
container.setAttribute('data-module', 'ga4-visual-editor-event-handlers')
Expand Down Expand Up @@ -70,8 +66,6 @@ describe('GOVUK.analyticsGa4.analyticsModules.Ga4VisualEditorEventHandlers', fun
text: 'BUTTON',
external: 'false',
method: 'primary click',
section: 'Title',
action: 'select',
tool_name: 'Visual Editor'
}

Expand Down

0 comments on commit 11556df

Please sign in to comment.