Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/tracking/tracking_spec.js')
-rw-r--r--spec/frontend/tracking/tracking_spec.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/frontend/tracking/tracking_spec.js b/spec/frontend/tracking/tracking_spec.js
index b7a2e4f4f51..d85299cdfc3 100644
--- a/spec/frontend/tracking/tracking_spec.js
+++ b/spec/frontend/tracking/tracking_spec.js
@@ -255,6 +255,23 @@ describe('Tracking', () => {
expect(snowplowSpy).toHaveBeenCalledWith('setCustomUrl', TEST_HOST);
});
+ describe('allowed hashes/fragments', () => {
+ it.each`
+ hash | appends | description
+ ${'note_abc_123'} | ${true} | ${'appends'}
+ ${'diff-content-819'} | ${true} | ${'appends'}
+ ${'first_heading'} | ${false} | ${'does not append'}
+ `('$description `$hash` hash', ({ hash, appends }) => {
+ window.gl.snowplowPseudonymizedPageUrl = TEST_HOST;
+ window.location.hash = hash;
+
+ Tracking.setAnonymousUrls();
+
+ const url = appends ? `${TEST_HOST}#${hash}` : TEST_HOST;
+ expect(snowplowSpy).toHaveBeenCalledWith('setCustomUrl', url);
+ });
+ });
+
it('does not set the referrer URL by default', () => {
window.gl.snowplowPseudonymizedPageUrl = TEST_HOST;
@@ -361,6 +378,16 @@ describe('Tracking', () => {
expect(eventSpy).toHaveBeenCalledWith(TEST_CATEGORY, 'click_input2', {
value: '0',
});
+
+ expect(snowplowSpy).toHaveBeenCalledWith(
+ 'trackStructEvent',
+ TEST_CATEGORY,
+ 'click_input2',
+ undefined,
+ undefined,
+ 0,
+ [standardContext],
+ );
});
it('handles checkbox values correctly', () => {