Commit fd3fa425 authored by Andrew Fontaine's avatar Andrew Fontaine Committed by Sarah GP

Add Snowplow to Toggles on Feature Flag Table

To better understand the usage of feature flags, this captures when a
feature flag is globally toggled on or off.
parent bfbed95f
......@@ -155,6 +155,9 @@ export default {
v-if="featureFlag.update_path"
:value="featureFlag.active"
:disabled="statusToggleDisabled(featureFlag)"
data-track-event="click_button"
data-track-label="feature_flag_toggle"
data-track-context="feature_flag_activity"
@change="toggleFeatureFlag(featureFlag)"
/>
<gl-badge v-else-if="featureFlag.active" variant="success">
......
---
title: Add Snowplow to Toggles on Feature Flag Table
merge_request: 39995
author:
type: other
......@@ -11,6 +11,7 @@ import {
LEGACY_FLAG,
DEFAULT_PERCENT_ROLLOUT,
} from 'ee/feature_flags/constants';
import { mockTracking } from 'helpers/tracking_helper';
const getDefaultProps = () => ({
featureFlags: [
......@@ -115,11 +116,13 @@ describe('Feature flag table', () => {
describe('when active and with an update toggle', () => {
let toggle;
let spy;
beforeEach(() => {
props.featureFlags[0].update_path = props.featureFlags[0].destroy_path;
createWrapper(props);
toggle = wrapper.find(GlToggle);
spy = mockTracking('_category_', toggle.element, jest.spyOn);
});
it('should have a toggle', () => {
......@@ -135,6 +138,15 @@ describe('Feature flag table', () => {
expect(wrapper.emitted('toggle-flag')).toEqual([[flag]]);
});
});
it('should track a click', () => {
toggle.trigger('click');
expect(spy).toHaveBeenCalledWith('_category_', 'click_button', {
context: 'feature_flag_activity',
label: 'feature_flag_toggle',
});
});
});
describe('with an active scope and a percentage rollout strategy', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment