bright-components 10.2.6 → 10.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/circle.yml +1 -2
  2. package/deploy.sh +6 -0
  3. package/dist/components/DayPicker/NewDayPicker/index.js +0 -28
  4. package/dist/components/DayPicker/index.js +2 -20
  5. package/dist/components/DayPickerPanel/HeaderDayPickerPanel/index.js +1 -18
  6. package/dist/components/DayPickerPanel/HeaderMonthPanel/index.js +0 -14
  7. package/dist/components/DayPickerPanel/HeaderYearPanel/index.js +2 -15
  8. package/dist/components/DayPickerPanel/Shortcuts/index.js +2 -16
  9. package/dist/components/DayPickerPanel/index.js +2 -74
  10. package/dist/components/EmployeeCard/index.js +1 -14
  11. package/dist/components/EmployeePicker/FilterBar/index.js +1 -28
  12. package/dist/components/EmployeePicker/Group/index.js +1 -41
  13. package/dist/components/FilterRadioGroup/index.js +2 -14
  14. package/dist/components/Form/index.js +4 -47
  15. package/dist/components/RadioBlock/index.js +10 -41
  16. package/dist/components/Time/OverlayBase/index.js +2 -25
  17. package/dist/components/Time/TimePicker/TimeOverlay/index.js +3 -26
  18. package/dist/components/TimePicker/Time/TimeOverlay/index.js +1 -58
  19. package/dist/setupTests.js +0 -7
  20. package/package.json +5 -7
  21. package/src/components/DayPicker/NewDayPicker/index.js +0 -21
  22. package/src/components/DayPicker/index.js +1 -16
  23. package/src/components/DayPicker/test.js +0 -85
  24. package/src/components/DayPickerPanel/HeaderDayPickerPanel/index.js +2 -22
  25. package/src/components/DayPickerPanel/HeaderDayPickerPanel/test.js +0 -34
  26. package/src/components/DayPickerPanel/HeaderMonthPanel/index.js +0 -10
  27. package/src/components/DayPickerPanel/HeaderMonthPanel/test.js +0 -25
  28. package/src/components/DayPickerPanel/HeaderYearPanel/index.js +3 -12
  29. package/src/components/DayPickerPanel/HeaderYearPanel/test.js +0 -17
  30. package/src/components/DayPickerPanel/Shortcuts/index.js +3 -17
  31. package/src/components/DayPickerPanel/Shortcuts/test.js +0 -39
  32. package/src/components/DayPickerPanel/index.js +1 -69
  33. package/src/components/DayPickerPanel/test.js +0 -177
  34. package/src/components/EmployeeCard/index.js +1 -15
  35. package/src/components/EmployeeCard/test.js +0 -20
  36. package/src/components/EmployeePicker/FilterBar/index.js +2 -26
  37. package/src/components/EmployeePicker/FilterBar/test.js +0 -29
  38. package/src/components/EmployeePicker/Group/index.js +1 -42
  39. package/src/components/EmployeePicker/Group/test.js +0 -21
  40. package/src/components/FilterRadioGroup/index.js +2 -14
  41. package/src/components/FilterRadioGroup/test.js +0 -13
  42. package/src/components/Form/index.js +1 -49
  43. package/src/components/Form/test.js +0 -73
  44. package/src/components/Modal/test.js +9 -9
  45. package/src/components/RadioBlock/index.js +14 -33
  46. package/src/components/RadioBlock/test.js +35 -155
  47. package/src/components/ResponsiveTabs/test.js +49 -86
  48. package/src/components/Time/OverlayBase/index.js +3 -21
  49. package/src/components/Time/OverlayBase/test.js +0 -50
  50. package/src/components/Time/TimePicker/TimeOverlay/index.js +4 -30
  51. package/src/components/Time/TimePicker/TimeOverlay/test.js +0 -24
  52. package/src/components/TimePicker/DayPart/test.js +1 -1
  53. package/src/components/TimePicker/Time/TimeOverlay/index.js +2 -50
  54. package/src/components/TimePicker/Time/TimeOverlay/test.js +1 -220
  55. package/src/index.js +1 -1
  56. package/src/setupTests.js +0 -2
  57. package/dist/components/TimePicker/utils/PickerGA/index.js +0 -24
  58. package/dist/utils/trackForm/index.js +0 -48
  59. package/src/components/TimePicker/utils/PickerGA/index.js +0 -6
  60. package/src/components/TimePicker/utils/PickerGA/test.js +0 -29
  61. package/src/utils/trackForm/index.js +0 -36
  62. package/src/utils/trackForm/test.js +0 -110
@@ -1,5 +1,5 @@
1
1
  import React, { useState, forwardRef } from 'react';
2
- import { arrayOf, func, number, oneOfType, shape, string } from 'prop-types';
2
+ import { arrayOf, func, number, oneOfType, shape } from 'prop-types';
3
3
  import millisecondsToDuration from 'utils/time/millisecondsToDuration';
4
4
  import styled from 'styled-components';
5
5
  import Spacing from 'constants/spacing';
@@ -8,7 +8,6 @@ import Variables from 'constants/vars';
8
8
  import Colors from 'constants/colors';
9
9
  import getBoundedValue from 'utils/numbers/getBoundedValue';
10
10
  import OutlineButton from 'components/Button/OutlineButton';
11
- import { event } from 'react-ga';
12
11
  import BrandButton from 'components/Button/BrandButton';
13
12
  import roundTo from 'utils/roundTo';
14
13
  import durationToMilliseconds from 'utils/time/durationToMilliseconds';
@@ -87,16 +86,7 @@ const convertHours = hour => {
87
86
 
88
87
  const TimeOverlay = forwardRef(
89
88
  (
90
- {
91
- value,
92
- onChange,
93
- onHide,
94
- hourIncrements,
95
- minuteIncrements,
96
- min,
97
- max,
98
- GA
99
- },
89
+ { value, onChange, onHide, hourIncrements, minuteIncrements, min, max },
100
90
  ref
101
91
  ) => {
102
92
  const sanitizeValue = unsanitizedValue =>
@@ -156,12 +146,6 @@ const TimeOverlay = forwardRef(
156
146
  type="button"
157
147
  onClick={() => {
158
148
  onHide();
159
- if (GA) {
160
- event({
161
- category: GA.category,
162
- action: `${GA.action} (Cancel)`
163
- });
164
- }
165
149
  }}
166
150
  >
167
151
  Cancel
@@ -180,14 +164,6 @@ const TimeOverlay = forwardRef(
180
164
  onClick={() => {
181
165
  onChange({ hours, minutes });
182
166
  onHide();
183
-
184
- if (GA) {
185
- event({
186
- category: GA.category,
187
- action: `${GA.action} (Apply)`,
188
- label: `${hours} hrs ${minutes} mins`
189
- });
190
- }
191
167
  }}
192
168
  data-e2e="time-apply"
193
169
  >
@@ -211,14 +187,12 @@ TimeOverlay.propTypes = {
211
187
  onChange: func.isRequired,
212
188
  onHide: func.isRequired,
213
189
  minuteIncrements: oneOfType([arrayOf(number), number]),
214
- hourIncrements: number,
215
- GA: shape({ category: string, action: string })
190
+ hourIncrements: number
216
191
  };
217
192
 
218
193
  TimeOverlay.defaultProps = {
219
194
  minuteIncrements: 1,
220
- hourIncrements: 1,
221
- GA: undefined
195
+ hourIncrements: 1
222
196
  };
223
197
 
224
198
  export default TimeOverlay;
@@ -1,17 +1,8 @@
1
1
  import React from 'react';
2
2
  import { render, fireEvent, within } from '@testing-library/react';
3
- import { event } from 'react-ga';
4
3
  import TimeOverlay from '.';
5
4
 
6
- jest.mock('react-ga');
7
-
8
- const gaSpec = { category: 'Cat', action: 'Action' };
9
-
10
5
  describe('<TimeOverlay />', () => {
11
- beforeEach(() => {
12
- event.mockReset();
13
- });
14
-
15
6
  it('should call onChange with the new value when apply is clicked', () => {
16
7
  const onChange = jest.fn();
17
8
  const { getAllByRole, getByText } = render(
@@ -96,7 +87,6 @@ describe('<TimeOverlay />', () => {
96
87
  value={{ hours: 3, minutes: 0 }}
97
88
  min={{ hours: 0, minutes: 0 }}
98
89
  max={{ hours: 23, minutes: 59 }}
99
- GA={gaSpec}
100
90
  />
101
91
  );
102
92
 
@@ -105,7 +95,6 @@ describe('<TimeOverlay />', () => {
105
95
 
106
96
  expect(onHide).not.toHaveBeenCalled();
107
97
  expect(onChange).not.toHaveBeenCalled();
108
- expect(event).not.toHaveBeenCalled();
109
98
 
110
99
  fireEvent.click(getByText('Apply'));
111
100
 
@@ -113,11 +102,6 @@ describe('<TimeOverlay />', () => {
113
102
  expect.objectContaining({ hours: 5, minutes: 0 })
114
103
  );
115
104
  expect(onHide).toHaveBeenCalledTimes(1);
116
- expect(event).toHaveBeenCalledWith({
117
- category: gaSpec.category,
118
- action: `${gaSpec.action} (Apply)`,
119
- label: '5 hrs 0 mins'
120
- });
121
105
  });
122
106
 
123
107
  it('should hide the panel and not apply the value when cancel is clicked', () => {
@@ -130,22 +114,15 @@ describe('<TimeOverlay />', () => {
130
114
  value={{ hours: 3, minutes: 0 }}
131
115
  min={{ hours: 0, minutes: 0 }}
132
116
  max={{ hours: 23, minutes: 59 }}
133
- GA={gaSpec}
134
117
  />
135
118
  );
136
119
 
137
120
  expect(onHide).not.toHaveBeenCalled();
138
121
  expect(onChange).not.toHaveBeenCalled();
139
- expect(event).not.toHaveBeenCalled();
140
122
 
141
123
  fireEvent.click(getByText('Cancel'));
142
124
  expect(onChange).not.toHaveBeenCalled();
143
125
  expect(onHide).toHaveBeenCalledTimes(1);
144
-
145
- expect(event).toHaveBeenCalledWith({
146
- category: gaSpec.category,
147
- action: `${gaSpec.action} (Cancel)`
148
- });
149
126
  });
150
127
 
151
128
  it('should display the selected time in 12 and 24 hour formats', () => {
@@ -156,7 +133,6 @@ describe('<TimeOverlay />', () => {
156
133
  value={{ hours: 0, minutes: 15 }}
157
134
  min={{ hours: 0, minutes: 0 }}
158
135
  max={{ hours: 23, minutes: 59 }}
159
- GA={gaSpec}
160
136
  />
161
137
  );
162
138
 
@@ -102,7 +102,7 @@ describe('TimePicker', () => {
102
102
  });
103
103
 
104
104
  it('should close overlay when clicked outside of the picker', () => {
105
- // overlay initially closed
105
+ // overlay initially closed here
106
106
  expect(element.queryByTestId('overlay')).not.toBeInTheDocument();
107
107
 
108
108
  // open overlay
@@ -1,14 +1,13 @@
1
1
  /* eslint max-lines: 0 */
2
2
 
3
3
  import React from 'react';
4
- import { number, bool, func, shape, string } from 'prop-types';
4
+ import { number, bool, func, shape } from 'prop-types';
5
5
  import plur from 'pluralize';
6
6
  import styled from 'styled-components';
7
7
  import autobind from 'react-autobind';
8
8
  import BrandButton from 'components/Button/BrandButton';
9
9
  import loopAround from '../../utils/loopAround';
10
10
  import loopAroundMinutes from '../../utils/loopAroundMinutes';
11
- import PickerGA from '../../utils/PickerGA';
12
11
  import LOOP_STATUS from '../../utils/constants/loopStatus';
13
12
  import TimeInput from '../TimeInput';
14
13
  import Actions from '../../Elements/Actions';
@@ -36,10 +35,6 @@ const DurationLabel = styled.span`
36
35
  `;
37
36
  DurationLabel.displayName = 'DurationLabel';
38
37
 
39
- const pad = value => (value < 10 ? `0${value}` : value);
40
-
41
- const getGATimeString = ({ hour, minute }) => `${pad(hour)}:${pad(minute)}`;
42
-
43
38
  class TimePickerOverlay extends React.Component {
44
39
  constructor(props) {
45
40
  super(props);
@@ -194,8 +189,7 @@ class TimePickerOverlay extends React.Component {
194
189
  onApply,
195
190
  onCancel,
196
191
  isDurationPicker,
197
- isDurationMinsOnly,
198
- GA
192
+ isDurationMinsOnly
199
193
  } = this.props;
200
194
  const { minute, hour } = this.state;
201
195
  const showHoursPicker = !(isDurationPicker && isDurationMinsOnly);
@@ -225,13 +219,6 @@ class TimePickerOverlay extends React.Component {
225
219
  setTime={(newTime, shouldApply) =>
226
220
  this.setState({ hour: newTime }, () => {
227
221
  if (shouldApply) {
228
- PickerGA({
229
- category: GA.category,
230
- action: `Apply time (${GA.action})`,
231
- label: getGATimeString(
232
- this.state
233
- )
234
- });
235
222
  onApply(this.state);
236
223
  }
237
224
  })
@@ -278,11 +265,6 @@ class TimePickerOverlay extends React.Component {
278
265
  setTime={(newTime, shouldApply) =>
279
266
  this.setState({ minute: newTime }, () => {
280
267
  if (shouldApply) {
281
- PickerGA({
282
- category: GA.category,
283
- action: `Apply time (${GA.action})`,
284
- label: getGATimeString(this.state)
285
- });
286
268
  onApply(this.state);
287
269
  }
288
270
  })
@@ -316,40 +298,12 @@ class TimePickerOverlay extends React.Component {
316
298
  <CancelLink
317
299
  onClick={() => {
318
300
  onCancel();
319
- PickerGA({
320
- category: GA.category,
321
- action: `Cancel time (${GA.action})`
322
- });
323
301
  }}
324
302
  >
325
303
  Cancel
326
304
  </CancelLink>
327
305
  <BrandButton
328
306
  onClick={() => {
329
- if (
330
- this.state.hasUserUsedArrowIcons &&
331
- this.state.hasUserEnteredInputManually
332
- ) {
333
- PickerGA({
334
- category: GA.category,
335
- action: 'Both Arrow and Manual input used'
336
- });
337
- } else if (this.state.hasUserUsedArrowIcons) {
338
- PickerGA({
339
- category: GA.category,
340
- action: 'Only arrows used'
341
- });
342
- } else if (this.state.hasUserEnteredInputManually) {
343
- PickerGA({
344
- category: GA.category,
345
- action: 'Only Manual input used'
346
- });
347
- }
348
- PickerGA({
349
- category: GA.category,
350
- action: `Apply time (${GA.action})`,
351
- label: getGATimeString(this.state)
352
- });
353
307
  onApply(this.state);
354
308
  }}
355
309
  data-e2e="time-apply"
@@ -364,7 +318,6 @@ class TimePickerOverlay extends React.Component {
364
318
  TimePickerOverlay.displayName = 'TimePickerOverlay';
365
319
 
366
320
  TimePickerOverlay.propTypes = {
367
- GA: shape({ action: string, label: string }),
368
321
  minute: number.isRequired,
369
322
  stepMinutes: number,
370
323
  minMinutes: number,
@@ -383,7 +336,6 @@ TimePickerOverlay.propTypes = {
383
336
  };
384
337
 
385
338
  TimePickerOverlay.defaultProps = {
386
- GA: { action: '', label: '' },
387
339
  stepMinutes: 1,
388
340
  stepHours: 1,
389
341
  isDurationPicker: false,
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
2
  import { mount } from 'enzyme';
3
- import ReactGA from 'react-ga';
4
3
  import TimeOverlayComp from '.';
5
4
 
6
5
  const consoleSpy = jest.spyOn(global.console, 'warn').mockImplementation();
7
- const GASpy = jest.spyOn(ReactGA, 'event');
8
6
  const onApply = jest.fn;
9
7
  const onCancel = jest.fn;
10
8
 
@@ -53,8 +51,7 @@ describe('TestOverlay', () => {
53
51
  it('should pass the right props down to TimeInput elements', () => {
54
52
  const Overlay = getTimeOverlay({
55
53
  onCancel: onCancelCallback,
56
- onApply: onApplyCallback,
57
- GA: { action: 'something else', category: 'something' }
54
+ onApply: onApplyCallback
58
55
  });
59
56
 
60
57
  const HourInput = Overlay.find('TimeInput').at(0);
@@ -532,222 +529,6 @@ describe('TestOverlay', () => {
532
529
  expect(mins).toBe(15);
533
530
  });
534
531
 
535
- describe('GA', () => {
536
- it('should amend state correctly when the GATrigger prop is invoked', () => {
537
- const DurationPicker = getTimeOverlay();
538
-
539
- DurationPicker.setState({ hasUserEnteredInputManually: false });
540
- DurationPicker.find('TimeInput')
541
- .at(0)
542
- .prop('hasUserEnteredInputManually')();
543
- expect(DurationPicker.state('hasUserEnteredInputManually')).toBe(
544
- true
545
- );
546
-
547
- DurationPicker.setState({ hasUserEnteredInputManually: false });
548
- DurationPicker.find('TimeInput')
549
- .at(1)
550
- .prop('hasUserEnteredInputManually')();
551
- expect(DurationPicker.state('hasUserEnteredInputManually')).toBe(
552
- true
553
- );
554
- });
555
-
556
- describe('should call the correct GA tag depending on what is in state', () => {
557
- // note: this section describes behaviour of GA in the specific
558
- // sections of the TimePicker. Upon clicking apply, GA will fire a
559
- // single event confirming that the user has hit apply. A second GA
560
- // event will also fire if the user has clicked either the manual input
561
- // or the arrow inputs. The tests below describe each case and also
562
- // the case where neither is clicked.
563
- beforeEach(() => {
564
- GASpy.mockReset();
565
- });
566
-
567
- const DurationPicker = getTimeOverlay({
568
- GA: { category: 'cat' },
569
- onCancel: onCancelCallback,
570
- onApply: onApplyCallback
571
- });
572
-
573
- it('should call the correct GA tag if user used both arrows and manual input', () => {
574
- DurationPicker.setState({
575
- hasUserEnteredInputManually: true,
576
- hasUserUsedArrowIcons: true
577
- });
578
- DurationPicker.find('BrandButton').prop('onClick')();
579
- expect(GASpy).toHaveBeenCalledWith({
580
- action: 'Both Arrow and Manual input used',
581
- category: 'cat',
582
- label: undefined
583
- });
584
- expect(GASpy).toHaveBeenCalledTimes(2);
585
- });
586
-
587
- it('should call the correct GA tag if the user only used manual input', () => {
588
- DurationPicker.setState({
589
- hasUserEnteredInputManually: true,
590
- hasUserUsedArrowIcons: false
591
- });
592
- DurationPicker.find('BrandButton').prop('onClick')();
593
- expect(GASpy).toHaveBeenCalledWith({
594
- action: 'Only Manual input used',
595
- category: 'cat',
596
- label: undefined
597
- });
598
- expect(GASpy).toHaveBeenCalledTimes(2);
599
- });
600
-
601
- it('should call the correct GA tag if the user only used arrows', () => {
602
- DurationPicker.setState({
603
- hasUserEnteredInputManually: false,
604
- hasUserUsedArrowIcons: true
605
- });
606
- DurationPicker.find('BrandButton').prop('onClick')();
607
- expect(GASpy).toHaveBeenCalledWith({
608
- action: 'Only arrows used',
609
- category: 'cat',
610
- label: undefined
611
- });
612
- expect(GASpy).toHaveBeenCalledTimes(2);
613
- });
614
-
615
- it('should only call the "apply" GA if the user has not used arrows or manual input', () => {
616
- DurationPicker.setState({
617
- hasUserEnteredInputManually: false,
618
- hasUserUsedArrowIcons: false
619
- });
620
- DurationPicker.find('BrandButton').prop('onClick')();
621
- expect(GASpy).toHaveBeenCalledTimes(1);
622
- });
623
- });
624
-
625
- it('should not call ga when category is not specified', () => {
626
- const DurationPicker = getTimeOverlay({
627
- onCancel: onCancelCallback,
628
- onApply: onApplyCallback
629
- });
630
-
631
- DurationPicker.find('UpIcon')
632
- .at(0)
633
- .simulate('click');
634
-
635
- expect(GASpy).not.toHaveBeenCalled();
636
- });
637
-
638
- it('should call ga when cancelling', () => {
639
- const DurationPicker = getTimeOverlay({
640
- onCancel: onCancelCallback,
641
- onApply: onApplyCallback,
642
- GA: { category: 'cat', action: 'start' }
643
- });
644
- DurationPicker.find('CancelLink').simulate('click');
645
-
646
- expect(GASpy).toHaveBeenLastCalledWith({
647
- action: 'Cancel time (start)',
648
- category: 'cat',
649
- label: undefined
650
- });
651
- });
652
-
653
- it('should call ga when applying', () => {
654
- const DurationPicker = getTimeOverlay({
655
- onCancel: onCancelCallback,
656
- onApply: onApplyCallback,
657
- GA: { category: 'cat', action: 'start' }
658
- });
659
- DurationPicker.find('BrandButton').simulate('click');
660
-
661
- expect(GASpy).toHaveBeenLastCalledWith({
662
- action: 'Apply time (start)',
663
- category: 'cat',
664
- label: '23:55'
665
- });
666
- });
667
-
668
- it('should call onApply and GA when shouldAppy is true (hrs)', () => {
669
- const DurationPicker = getTimeOverlay({
670
- onCancel: onCancelCallback,
671
- onApply: onApplyCallback,
672
- GA: { category: 'cat', action: 'start' }
673
- });
674
-
675
- expect(GASpy).not.toHaveBeenCalled();
676
- const input = DurationPicker.find('TimeInput').at(0);
677
- input.prop('setTime')(10, true);
678
-
679
- expect(onApplyCallback).toHaveBeenCalled();
680
- expect(GASpy).toHaveBeenLastCalledWith({
681
- action: 'Apply time (start)',
682
- category: 'cat',
683
- label: '10:55'
684
- });
685
- });
686
-
687
- it('should call onApply when shouldAppy is true (mins)', () => {
688
- const DurationPicker = getTimeOverlay({
689
- onCancel: onCancelCallback,
690
- onApply: onApplyCallback,
691
- GA: { category: 'cat', action: 'start' }
692
- });
693
-
694
- expect(GASpy).not.toHaveBeenCalled();
695
- const input = DurationPicker.find('TimeInput').at(1);
696
- input.prop('setTime')(10, true);
697
-
698
- expect(onApplyCallback).toHaveBeenCalled();
699
- expect(GASpy).toHaveBeenLastCalledWith({
700
- action: 'Apply time (start)',
701
- category: 'cat',
702
- label: '23:10'
703
- });
704
- });
705
-
706
- it('should pad values that are less than 10', () => {
707
- const DurationPicker = getTimeOverlay({
708
- onCancel: onCancelCallback,
709
- onApply: onApplyCallback,
710
- GA: { category: 'cat', action: 'start' }
711
- });
712
-
713
- expect(GASpy).not.toHaveBeenCalled();
714
- const input = DurationPicker.find('TimeInput').at(0);
715
- input.prop('setTime')(9, true);
716
-
717
- const minsInput = DurationPicker.find('TimeInput').at(1);
718
- minsInput.prop('setTime')(9, true);
719
-
720
- expect(onApplyCallback).toHaveBeenCalled();
721
- expect(GASpy).toHaveBeenLastCalledWith({
722
- action: 'Apply time (start)',
723
- category: 'cat',
724
- label: '09:09'
725
- });
726
- });
727
-
728
- it('should call set the label with correct time when hour is greater than 23', () => {
729
- const DurationPicker = getTimeOverlay({
730
- onCancel: onCancelCallback,
731
- onApply: onApplyCallback,
732
- GA: { category: 'cat', action: 'start' }
733
- });
734
-
735
- expect(GASpy).not.toHaveBeenCalled();
736
- const input = DurationPicker.find('TimeInput').at(0);
737
- input.prop('setTime')(25, true);
738
-
739
- const minsInput = DurationPicker.find('TimeInput').at(1);
740
- minsInput.prop('setTime')(10, true);
741
-
742
- expect(onApplyCallback).toHaveBeenCalled();
743
- expect(GASpy).toHaveBeenLastCalledWith({
744
- action: 'Apply time (start)',
745
- category: 'cat',
746
- label: '25:10'
747
- });
748
- });
749
- });
750
-
751
532
  describe('should focus on input field on mount', () => {
752
533
  it('should focus on hour field', () => {
753
534
  getTimeOverlay({
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** This file is auto-generated */
2
-
2
+ /** this comment is to force a rebuild */
3
3
  import A from 'components/A';
4
4
  import Alert from 'components/Alert';
5
5
  import Avatar from 'components/Avatar';
package/src/setupTests.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { configure } from 'enzyme';
2
2
  import { configure as RTLConfig } from '@testing-library/react';
3
3
  import Adapter from 'enzyme-adapter-react-16';
4
- import ReactGA from 'react-ga';
5
4
  import 'jest-enzyme';
6
5
  import 'jest-styled-components';
7
6
  import '@testing-library/jest-dom/extend-expect';
@@ -24,7 +23,6 @@ beforeEach(() => {
24
23
 
25
24
  Element.prototype.scrollIntoView = jest.fn();
26
25
 
27
- ReactGA.initialize('foo', { testMode: true });
28
26
  jest.clearAllMocks();
29
27
  });
30
28
 
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
-
6
- var _reactGa = _interopRequireDefault(require("react-ga"));
7
-
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
-
10
- const PickerGA = _ref => {
11
- let {
12
- action,
13
- category,
14
- label
15
- } = _ref;
16
- return category && _reactGa.default.event({
17
- category,
18
- action,
19
- label
20
- });
21
- };
22
-
23
- var _default = PickerGA;
24
- exports.default = _default;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
-
6
- var _reactGa = _interopRequireDefault(require("react-ga"));
7
-
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
-
10
- const trackForm = category => e => {
11
- const {
12
- type,
13
- checked,
14
- value,
15
- name
16
- } = e.target || e;
17
-
18
- const getAttribute = attr => e.target && e.target.getAttribute(attr);
19
-
20
- const isPassword = type === 'password';
21
- const trackValue = getAttribute('data-track-value') === 'on' ? value : undefined;
22
- const label = getAttribute('data-track-label') || trackValue;
23
- let action = getAttribute('data-track-action') || name;
24
-
25
- if (type === 'checkbox') {
26
- action += checked ? ' on' : ' off';
27
- } // will be turned on when all react forms are updated
28
- // if (!action || action === 'null') {
29
- // return;
30
- // }
31
-
32
-
33
- if (isPassword || !label) {
34
- return _reactGa.default.event({
35
- category,
36
- action
37
- });
38
- }
39
-
40
- _reactGa.default.event({
41
- category,
42
- action,
43
- label
44
- });
45
- };
46
-
47
- var _default = trackForm;
48
- exports.default = _default;
@@ -1,6 +0,0 @@
1
- import ReactGA from 'react-ga';
2
-
3
- const PickerGA = ({ action, category, label }) =>
4
- category && ReactGA.event({ category, action, label });
5
-
6
- export default PickerGA;
@@ -1,29 +0,0 @@
1
- import ReactGA from 'react-ga';
2
- import PickerGA from '.';
3
-
4
- jest.mock('react-ga');
5
-
6
- describe('PickerGA', () => {
7
- it('should call ReactGA.event if category is defined', () => {
8
- expect(ReactGA.event).not.toHaveBeenCalled();
9
- PickerGA({
10
- category: 'test-category',
11
- action: 'test-action',
12
- label: 'test-action'
13
- });
14
- expect(ReactGA.event).toHaveBeenCalledWith({
15
- action: 'test-action',
16
- category: 'test-category',
17
- label: 'test-action'
18
- });
19
- });
20
-
21
- it('should NOT call ReactGA.event if category is defined', () => {
22
- expect(ReactGA.event).not.toHaveBeenCalled();
23
- PickerGA({
24
- action: 'test-action',
25
- label: 'test-action'
26
- });
27
- expect(ReactGA.event).not.toHaveBeenCalled();
28
- });
29
- });
@@ -1,36 +0,0 @@
1
- import ReactGA from 'react-ga';
2
-
3
- const trackForm = category => e => {
4
- const { type, checked, value, name } = e.target || e;
5
- const getAttribute = attr => e.target && e.target.getAttribute(attr);
6
- const isPassword = type === 'password';
7
- const trackValue =
8
- getAttribute('data-track-value') === 'on' ? value : undefined;
9
- const label = getAttribute('data-track-label') || trackValue;
10
-
11
- let action = getAttribute('data-track-action') || name;
12
-
13
- if (type === 'checkbox') {
14
- action += checked ? ' on' : ' off';
15
- }
16
-
17
- // will be turned on when all react forms are updated
18
- // if (!action || action === 'null') {
19
- // return;
20
- // }
21
-
22
- if (isPassword || !label) {
23
- return ReactGA.event({
24
- category,
25
- action
26
- });
27
- }
28
-
29
- ReactGA.event({
30
- category,
31
- action,
32
- label
33
- });
34
- };
35
-
36
- export default trackForm;