bright-components 10.2.7 → 10.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) 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/Modal/index.js +1 -23
  16. package/dist/components/RadioBlock/index.js +10 -41
  17. package/dist/components/Snackbar/index.js +1 -17
  18. package/dist/components/Time/OverlayBase/index.js +2 -25
  19. package/dist/components/Time/TimePicker/TimeOverlay/index.js +3 -26
  20. package/dist/components/TimePicker/Time/TimeOverlay/index.js +1 -58
  21. package/dist/setupTests.js +0 -7
  22. package/package.json +6 -8
  23. package/src/components/DayPicker/NewDayPicker/index.js +0 -21
  24. package/src/components/DayPicker/index.js +1 -16
  25. package/src/components/DayPicker/test.js +0 -85
  26. package/src/components/DayPickerPanel/HeaderDayPickerPanel/index.js +2 -22
  27. package/src/components/DayPickerPanel/HeaderDayPickerPanel/test.js +0 -34
  28. package/src/components/DayPickerPanel/HeaderMonthPanel/index.js +0 -10
  29. package/src/components/DayPickerPanel/HeaderMonthPanel/test.js +0 -25
  30. package/src/components/DayPickerPanel/HeaderYearPanel/index.js +3 -12
  31. package/src/components/DayPickerPanel/HeaderYearPanel/test.js +0 -17
  32. package/src/components/DayPickerPanel/Shortcuts/index.js +3 -17
  33. package/src/components/DayPickerPanel/Shortcuts/test.js +0 -39
  34. package/src/components/DayPickerPanel/index.js +1 -69
  35. package/src/components/DayPickerPanel/test.js +0 -177
  36. package/src/components/EmployeeCard/index.js +1 -15
  37. package/src/components/EmployeeCard/test.js +0 -20
  38. package/src/components/EmployeePicker/FilterBar/index.js +2 -26
  39. package/src/components/EmployeePicker/FilterBar/test.js +0 -29
  40. package/src/components/EmployeePicker/Group/index.js +1 -42
  41. package/src/components/EmployeePicker/Group/test.js +0 -21
  42. package/src/components/FilterRadioGroup/index.js +2 -14
  43. package/src/components/FilterRadioGroup/test.js +0 -13
  44. package/src/components/Form/index.js +1 -49
  45. package/src/components/Form/test.js +0 -73
  46. package/src/components/Modal/index.js +1 -22
  47. package/src/components/Modal/test.js +9 -9
  48. package/src/components/RadioBlock/index.js +14 -33
  49. package/src/components/RadioBlock/test.js +35 -155
  50. package/src/components/ResponsiveTabs/test.js +49 -86
  51. package/src/components/Snackbar/index.js +1 -16
  52. package/src/components/Time/OverlayBase/index.js +3 -21
  53. package/src/components/Time/OverlayBase/test.js +0 -50
  54. package/src/components/Time/TimePicker/TimeOverlay/index.js +4 -30
  55. package/src/components/Time/TimePicker/TimeOverlay/test.js +0 -24
  56. package/src/components/TimePicker/DayPart/test.js +1 -1
  57. package/src/components/TimePicker/Time/TimeOverlay/index.js +2 -50
  58. package/src/components/TimePicker/Time/TimeOverlay/test.js +1 -220
  59. package/src/index.js +1 -1
  60. package/src/setupTests.js +0 -2
  61. package/dist/components/TimePicker/utils/PickerGA/index.js +0 -24
  62. package/dist/utils/trackForm/index.js +0 -48
  63. package/src/components/TimePicker/utils/PickerGA/index.js +0 -6
  64. package/src/components/TimePicker/utils/PickerGA/test.js +0 -29
  65. package/src/utils/trackForm/index.js +0 -36
  66. package/src/utils/trackForm/test.js +0 -110
@@ -1,25 +1,24 @@
1
- import React from 'react';
2
- import { bool, func, string, node, shape } from 'prop-types';
3
- import styled from 'styled-components';
4
- import Colors from 'constants/colors';
5
- import Variables from 'constants/vars';
6
- import { event } from 'react-ga';
1
+ import React from "react";
2
+ import { bool, func, string, node, shape } from "prop-types";
3
+ import styled from "styled-components";
4
+ import Colors from "constants/colors";
5
+ import Variables from "constants/vars";
7
6
 
8
7
  const Option = styled.div`
9
8
  position: relative;
10
9
  text-align: left;
11
10
  border: 1px solid
12
11
  ${props => (props.selected ? Colors.primaryLight : Colors.borderColor)};
13
- background: ${props => (props.selected ? Colors.primaryLighter : '#fff')};
12
+ background: ${props => (props.selected ? Colors.primaryLighter : "#fff")};
14
13
  ${props => props.selected && `box-shadow: 1px 4px 8px -4px #888888`};
15
14
  border-radius: ${Variables.borderRadius};
16
15
  height: 100%;
17
- opacity: ${props => (props.disabled ? '0.3' : 1)};
16
+ opacity: ${props => (props.disabled ? "0.3" : 1)};
18
17
  `;
19
- Option.displayName = 'Option';
18
+ Option.displayName = "Option";
20
19
 
21
20
  const Radio = styled.input`
22
- cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
21
+ cursor: ${props => (props.disabled ? "not-allowed" : "pointer")};
23
22
  opacity: 0 !important;
24
23
  position: absolute;
25
24
  top: 0;
@@ -29,19 +28,11 @@ const Radio = styled.input`
29
28
  width: 100%;
30
29
  height: 100%;
31
30
  `;
32
- Radio.displayName = 'Radio';
31
+ Radio.displayName = "Radio";
33
32
 
34
33
  class RadioBlock extends React.Component {
35
34
  componentDidMount() {
36
- const {
37
- GA: { category, action },
38
- checked
39
- } = this.props;
40
-
41
- if (category && action && checked) {
42
- const defaultAction = `Defaulted to ${action}`;
43
- event({ category, action: defaultAction });
44
- }
35
+ const { checked } = this.props;
45
36
  }
46
37
 
47
38
  render() {
@@ -53,7 +44,6 @@ class RadioBlock extends React.Component {
53
44
  value,
54
45
  children,
55
46
  className,
56
- GA: { category, action },
57
47
  ...props
58
48
  } = this.props;
59
49
 
@@ -72,10 +62,6 @@ class RadioBlock extends React.Component {
72
62
  checked={checked}
73
63
  disabled={disabled}
74
64
  onChange={evt => {
75
- if (category && action && !checked) {
76
- const defaultAction = `Switched to ${action}`;
77
- event({ category, action: defaultAction });
78
- }
79
65
  onChange(evt);
80
66
  }}
81
67
  {...props}
@@ -92,17 +78,12 @@ RadioBlock.propTypes = {
92
78
  name: string.isRequired,
93
79
  value: string.isRequired,
94
80
  children: node.isRequired,
95
- className: string,
96
- GA: shape({
97
- category: string,
98
- action: string
99
- })
81
+ className: string
100
82
  };
101
83
 
102
84
  RadioBlock.defaultProps = {
103
- className: '',
104
- disabled: false,
105
- GA: {}
85
+ className: "",
86
+ disabled: false
106
87
  };
107
88
 
108
89
  export default RadioBlock;
@@ -1,17 +1,15 @@
1
- import React from 'react';
2
- import { render, fireEvent } from '@testing-library/react';
3
- import Colors from 'constants/colors';
4
- import { event } from 'react-ga';
1
+ import React from "react";
2
+ import { render, fireEvent } from "@testing-library/react";
3
+ import Colors from "constants/colors";
5
4
 
6
- import RadioBlock from '.';
5
+ import RadioBlock from ".";
7
6
 
8
7
  const child = <div data-testid="test-child">child</div>;
9
8
 
10
9
  const onChange = jest.fn();
11
- jest.mock('react-ga');
12
10
 
13
- describe('Radio Block', () => {
14
- it('should render styles when unchecked', () => {
11
+ describe("Radio Block", () => {
12
+ it("should render styles when unchecked", () => {
15
13
  const { getByTestId } = render(
16
14
  <RadioBlock
17
15
  checked={false}
@@ -24,14 +22,14 @@ describe('Radio Block', () => {
24
22
  </RadioBlock>
25
23
  );
26
24
 
27
- expect(getByTestId('option')).toHaveStyleRule(
28
- 'border',
25
+ expect(getByTestId("option")).toHaveStyleRule(
26
+ "border",
29
27
  `1px solid ${Colors.borderColor}`
30
28
  );
31
- expect(getByTestId('option')).toHaveStyleRule('background', '#fff');
29
+ expect(getByTestId("option")).toHaveStyleRule("background", "#fff");
32
30
  });
33
31
 
34
- it('should render styles when checked', () => {
32
+ it("should render styles when checked", () => {
35
33
  const { getByTestId } = render(
36
34
  <RadioBlock
37
35
  checked
@@ -44,17 +42,17 @@ describe('Radio Block', () => {
44
42
  </RadioBlock>
45
43
  );
46
44
 
47
- expect(getByTestId('option')).toHaveStyleRule(
48
- 'border',
45
+ expect(getByTestId("option")).toHaveStyleRule(
46
+ "border",
49
47
  `1px solid ${Colors.primaryLight}`
50
48
  );
51
- expect(getByTestId('option')).toHaveStyleRule(
52
- 'background',
49
+ expect(getByTestId("option")).toHaveStyleRule(
50
+ "background",
53
51
  Colors.primaryLighter
54
52
  );
55
53
  });
56
54
 
57
- it('should render the supplied children', () => {
55
+ it("should render the supplied children", () => {
58
56
  const { getByTestId } = render(
59
57
  <RadioBlock
60
58
  checked={false}
@@ -66,10 +64,10 @@ describe('Radio Block', () => {
66
64
  {child}
67
65
  </RadioBlock>
68
66
  );
69
- expect(getByTestId('test-child')).toHaveTextContent('child');
67
+ expect(getByTestId("test-child")).toHaveTextContent("child");
70
68
  });
71
69
 
72
- it('should render a radio input', () => {
70
+ it("should render a radio input", () => {
73
71
  const { getByRole } = render(
74
72
  <RadioBlock
75
73
  checked={false}
@@ -82,12 +80,12 @@ describe('Radio Block', () => {
82
80
  </RadioBlock>
83
81
  );
84
82
 
85
- expect(getByRole('radio')).toBeInTheDocument();
86
- expect(getByRole('radio')).toHaveAttribute('name', 'nameyname');
87
- expect(getByRole('radio')).toHaveAttribute('value', 'valerie');
83
+ expect(getByRole("radio")).toBeInTheDocument();
84
+ expect(getByRole("radio")).toHaveAttribute("name", "nameyname");
85
+ expect(getByRole("radio")).toHaveAttribute("value", "valerie");
88
86
  });
89
87
 
90
- it('should make option opaque if disabled', () => {
88
+ it("should make option opaque if disabled", () => {
91
89
  const elem = render(
92
90
  <RadioBlock
93
91
  checked={false}
@@ -101,129 +99,11 @@ describe('Radio Block', () => {
101
99
  </RadioBlock>
102
100
  );
103
101
 
104
- expect(elem.getByTestId('option')).toHaveStyleRule('opacity', '0.3');
102
+ expect(elem.getByTestId("option")).toHaveStyleRule("opacity", "0.3");
105
103
  });
106
104
 
107
- describe('GA', () => {
108
- it('should call default GA event if component is rendered with checked option', () => {
109
- expect(event).not.toHaveBeenCalled();
110
- render(
111
- <RadioBlock
112
- checked
113
- onChange={onChange}
114
- name="nameyname"
115
- value="valerie"
116
- className="class"
117
- GA={{
118
- category: 'ga-category-mock',
119
- action: 'ga-action-mock'
120
- }}
121
- >
122
- {child}
123
- </RadioBlock>
124
- );
125
- expect(event).toHaveBeenCalledWith({
126
- action: 'Defaulted to ga-action-mock',
127
- category: 'ga-category-mock'
128
- });
129
- });
130
-
131
- it('should not call default GA event if component is not rendered with checked state', () => {
132
- expect(event).not.toHaveBeenCalled();
133
- render(
134
- <RadioBlock
135
- checked={false}
136
- onChange={onChange}
137
- name="nameyname"
138
- value="valerie"
139
- className="class"
140
- GA={{
141
- category: 'ga-category-mock',
142
- action: 'ga-action-mock'
143
- }}
144
- >
145
- {child}
146
- </RadioBlock>
147
- );
148
- expect(event).not.toHaveBeenCalled();
149
- });
150
-
151
- it('should not call default GA event if component does not have A GA prop', () => {
152
- expect(event).not.toHaveBeenCalled();
153
- render(
154
- <RadioBlock
155
- checked
156
- onChange={onChange}
157
- name="nameyname"
158
- value="valerie"
159
- className="class"
160
- >
161
- {child}
162
- </RadioBlock>
163
- );
164
- expect(event).not.toHaveBeenCalled();
165
- });
166
- });
167
-
168
- describe('GA onChange events', () => {
169
- it('should trigger GA event when user click on an unchecked radio', () => {
170
- expect(event).not.toHaveBeenCalled();
171
- const elem = render(
172
- <RadioBlock
173
- checked={false}
174
- onChange={onChange}
175
- name="nameyname"
176
- value="valerie"
177
- className="class"
178
- GA={{
179
- category: 'ga-category-mock',
180
- action: 'ga-action-mock'
181
- }}
182
- >
183
- {child}
184
- </RadioBlock>
185
- );
186
-
187
- fireEvent.click(elem.getByRole('radio'), {
188
- target: { value: 'valerie' }
189
- });
190
-
191
- expect(event).toHaveBeenCalledWith({
192
- action: 'Switched to ga-action-mock',
193
- category: 'ga-category-mock'
194
- });
195
- });
196
-
197
- it('should NOT trigger GA event when user clicks on a checked radio button', () => {
198
- expect(event).not.toHaveBeenCalled();
199
- const elem = render(
200
- <RadioBlock
201
- checked
202
- onChange={onChange}
203
- name="nameyname"
204
- value="valerie"
205
- className="class"
206
- GA={{
207
- category: 'ga-category-mock',
208
- action: 'ga-action-mock'
209
- }}
210
- >
211
- {child}
212
- </RadioBlock>
213
- );
214
-
215
- event.mockClear(); // to clear the event call that happened on mounting component
216
-
217
- fireEvent.click(elem.getByRole('radio'), {
218
- target: { value: 'valerie' }
219
- });
220
-
221
- expect(event).not.toHaveBeenCalled();
222
- });
223
- });
224
-
225
- describe('Disabled options', () => {
226
- it('should use not-allowed cursor when disabled', () => {
105
+ describe("Disabled options", () => {
106
+ it("should use not-allowed cursor when disabled", () => {
227
107
  const elem = render(
228
108
  <RadioBlock
229
109
  checked={false}
@@ -237,17 +117,17 @@ describe('Radio Block', () => {
237
117
  </RadioBlock>
238
118
  );
239
119
 
240
- expect(elem.getByTestId('option')).toHaveStyleRule(
241
- 'opacity',
242
- '0.3'
120
+ expect(elem.getByTestId("option")).toHaveStyleRule(
121
+ "opacity",
122
+ "0.3"
243
123
  );
244
- expect(elem.getByRole('radio')).toHaveStyleRule(
245
- 'cursor',
246
- 'not-allowed'
124
+ expect(elem.getByRole("radio")).toHaveStyleRule(
125
+ "cursor",
126
+ "not-allowed"
247
127
  );
248
128
  });
249
129
 
250
- it('should use a pointer cursor when not disabled', () => {
130
+ it("should use a pointer cursor when not disabled", () => {
251
131
  const elem = render(
252
132
  <RadioBlock
253
133
  checked={false}
@@ -261,10 +141,10 @@ describe('Radio Block', () => {
261
141
  </RadioBlock>
262
142
  );
263
143
 
264
- expect(elem.getByTestId('option')).toHaveStyleRule('opacity', '1');
265
- expect(elem.getByRole('radio')).toHaveStyleRule(
266
- 'cursor',
267
- 'pointer'
144
+ expect(elem.getByTestId("option")).toHaveStyleRule("opacity", "1");
145
+ expect(elem.getByRole("radio")).toHaveStyleRule(
146
+ "cursor",
147
+ "pointer"
268
148
  );
269
149
  });
270
150
  });
@@ -1,13 +1,10 @@
1
- import React from 'react';
2
- import { render, fireEvent } from '@testing-library/react';
3
- import TabPanel from 'components/Tabs/TabPanel';
4
- import { event } from 'react-ga';
5
- import ResponsiveTabs from '.';
1
+ import React from "react";
2
+ import { render, fireEvent } from "@testing-library/react";
3
+ import TabPanel from "components/Tabs/TabPanel";
4
+ import ResponsiveTabs from ".";
6
5
 
7
- jest.mock('react-ga');
8
-
9
- describe('<ResponsiveTabs />', () => {
10
- it('should handle when defaultIndex is larger than the amount of tabs', () => {
6
+ describe("<ResponsiveTabs />", () => {
7
+ it("should handle when defaultIndex is larger than the amount of tabs", () => {
11
8
  const { getByRole, getAllByRole } = render(
12
9
  <ResponsiveTabs defaultIndex={3}>
13
10
  <TabPanel name="One">One</TabPanel>
@@ -15,13 +12,13 @@ describe('<ResponsiveTabs />', () => {
15
12
  </ResponsiveTabs>
16
13
  );
17
14
 
18
- expect(getByRole('combobox')).toBeInTheDocument();
19
- expect(getAllByRole('option')).toHaveLength(2);
15
+ expect(getByRole("combobox")).toBeInTheDocument();
16
+ expect(getAllByRole("option")).toHaveLength(2);
20
17
 
21
18
  // doesn't throw an error is good
22
19
  });
23
20
 
24
- it('should render a dropdown for selecting tabs on mobile', () => {
21
+ it("should render a dropdown for selecting tabs on mobile", () => {
25
22
  const { getByRole, getAllByRole } = render(
26
23
  <ResponsiveTabs>
27
24
  <TabPanel name="One">One</TabPanel>
@@ -29,17 +26,13 @@ describe('<ResponsiveTabs />', () => {
29
26
  </ResponsiveTabs>
30
27
  );
31
28
 
32
- expect(getByRole('combobox')).toBeInTheDocument();
33
- expect(getAllByRole('option')).toHaveLength(2);
29
+ expect(getByRole("combobox")).toBeInTheDocument();
30
+ expect(getAllByRole("option")).toHaveLength(2);
34
31
  });
35
32
 
36
- it('should change tabs when the dropdown is used', () => {
33
+ it("should change tabs when the dropdown is used", () => {
37
34
  const { getByRole, getByTestId } = render(
38
- <ResponsiveTabs
39
- onSelected={i => {
40
- event({ category: 'tabs', action: 'tab change', label: i });
41
- }}
42
- >
35
+ <ResponsiveTabs onSelected={i => {}}>
43
36
  <TabPanel name="One" data-testid="tab1">
44
37
  One
45
38
  </TabPanel>
@@ -49,29 +42,19 @@ describe('<ResponsiveTabs />', () => {
49
42
  </ResponsiveTabs>
50
43
  );
51
44
 
52
- expect(getByTestId('tab1')).toBeVisible();
53
- expect(getByTestId('tab2')).not.toBeVisible();
54
-
55
- const dropdown = getByRole('combobox');
56
- fireEvent.change(dropdown, { target: { value: 'Two' } });
45
+ expect(getByTestId("tab1")).toBeVisible();
46
+ expect(getByTestId("tab2")).not.toBeVisible();
57
47
 
58
- expect(getByTestId('tab1')).not.toBeVisible();
59
- expect(getByTestId('tab2')).toBeVisible();
48
+ const dropdown = getByRole("combobox");
49
+ fireEvent.change(dropdown, { target: { value: "Two" } });
60
50
 
61
- expect(event).toHaveBeenCalledWith({
62
- action: 'tab change',
63
- category: 'tabs',
64
- label: 1
65
- });
51
+ expect(getByTestId("tab1")).not.toBeVisible();
52
+ expect(getByTestId("tab2")).toBeVisible();
66
53
  });
67
54
 
68
- it('should change tabs when the tablist is used', () => {
55
+ it("should change tabs when the tablist is used", () => {
69
56
  const { getAllByRole, getByTestId } = render(
70
- <ResponsiveTabs
71
- onSelected={i => {
72
- event({ category: 'tabs', action: 'tab change', label: i });
73
- }}
74
- >
57
+ <ResponsiveTabs onSelected={i => {}}>
75
58
  <TabPanel name="One" data-testid="tab1">
76
59
  One
77
60
  </TabPanel>
@@ -81,48 +64,28 @@ describe('<ResponsiveTabs />', () => {
81
64
  </ResponsiveTabs>
82
65
  );
83
66
 
84
- expect(getByTestId('tab1')).toBeVisible();
85
- expect(getByTestId('tab2')).not.toBeVisible();
67
+ expect(getByTestId("tab1")).toBeVisible();
68
+ expect(getByTestId("tab2")).not.toBeVisible();
86
69
 
87
- const { 1: secondTab } = getAllByRole('tab');
70
+ const { 1: secondTab } = getAllByRole("tab");
88
71
  fireEvent.click(secondTab);
89
72
 
90
- expect(getByTestId('tab1')).not.toBeVisible();
91
- expect(getByTestId('tab2')).toBeVisible();
92
-
93
- expect(event).toHaveBeenCalledWith({
94
- action: 'tab change',
95
- category: 'tabs',
96
- label: 1
97
- });
98
- });
99
-
100
- it('not passing in onSelected', () => {
101
- const { getByRole } = render(
102
- <ResponsiveTabs>
103
- <TabPanel name="One">One</TabPanel>
104
- </ResponsiveTabs>
105
- );
106
-
107
- fireEvent.change(getByRole('combobox'), { target: { value: 'One' } });
108
- expect(event).not.toHaveBeenCalled();
109
-
110
- fireEvent.click(getByRole('tab'));
111
- expect(event).not.toHaveBeenCalled();
73
+ expect(getByTestId("tab1")).not.toBeVisible();
74
+ expect(getByTestId("tab2")).toBeVisible();
112
75
  });
113
76
 
114
- it('should support tab auto width', () => {
77
+ it("should support tab auto width", () => {
115
78
  const { getByRole } = render(
116
79
  <ResponsiveTabs autoTabWidth>
117
80
  <TabPanel name="One">One</TabPanel>
118
81
  </ResponsiveTabs>
119
82
  );
120
83
 
121
- expect(getByRole('tab')).toHaveStyleRule({ flex: '1 1 auto' });
84
+ expect(getByRole("tab")).toHaveStyleRule({ flex: "1 1 auto" });
122
85
  });
123
86
 
124
- describe('when tablist inferred from children', () => {
125
- it('should render a tablist inferred from children', () => {
87
+ describe("when tablist inferred from children", () => {
88
+ it("should render a tablist inferred from children", () => {
126
89
  const { getByRole, getAllByRole } = render(
127
90
  <ResponsiveTabs>
128
91
  <TabPanel name="One">One</TabPanel>
@@ -131,11 +94,11 @@ describe('<ResponsiveTabs />', () => {
131
94
  </ResponsiveTabs>
132
95
  );
133
96
 
134
- expect(getByRole('tablist')).toBeInTheDocument();
135
- expect(getAllByRole('tab')).toHaveLength(3);
97
+ expect(getByRole("tablist")).toBeInTheDocument();
98
+ expect(getAllByRole("tab")).toHaveLength(3);
136
99
  });
137
100
 
138
- it('should handle null elements', () => {
101
+ it("should handle null elements", () => {
139
102
  const { getByRole, getAllByRole } = render(
140
103
  <ResponsiveTabs>
141
104
  <TabPanel name="One">One</TabPanel>
@@ -143,11 +106,11 @@ describe('<ResponsiveTabs />', () => {
143
106
  </ResponsiveTabs>
144
107
  );
145
108
 
146
- expect(getByRole('tablist')).toBeInTheDocument();
147
- expect(getAllByRole('tab')).toHaveLength(1);
109
+ expect(getByRole("tablist")).toBeInTheDocument();
110
+ expect(getAllByRole("tab")).toHaveLength(1);
148
111
  });
149
112
 
150
- it('should support counters', () => {
113
+ it("should support counters", () => {
151
114
  const { getByText } = render(
152
115
  <ResponsiveTabs>
153
116
  <TabPanel name="One" counter={999}>
@@ -160,14 +123,14 @@ describe('<ResponsiveTabs />', () => {
160
123
  </ResponsiveTabs>
161
124
  );
162
125
 
163
- expect(getByText('999')).toBeInTheDocument();
164
- expect(getByText('3333')).toBeInTheDocument();
126
+ expect(getByText("999")).toBeInTheDocument();
127
+ expect(getByText("3333")).toBeInTheDocument();
165
128
  });
166
129
  });
167
130
 
168
- describe('when tab list is passed as a prop', () => {
169
- it('should render a tablist', () => {
170
- const tabs = [{ name: 'One' }, { name: 'Two' }, { name: 'Three' }];
131
+ describe("when tab list is passed as a prop", () => {
132
+ it("should render a tablist", () => {
133
+ const tabs = [{ name: "One" }, { name: "Two" }, { name: "Three" }];
171
134
  const { getByRole, getAllByRole } = render(
172
135
  <ResponsiveTabs tabs={tabs}>
173
136
  <TabPanel>One</TabPanel>
@@ -176,15 +139,15 @@ describe('<ResponsiveTabs />', () => {
176
139
  </ResponsiveTabs>
177
140
  );
178
141
 
179
- expect(getByRole('tablist')).toBeInTheDocument();
180
- expect(getAllByRole('tab')).toHaveLength(tabs.length);
142
+ expect(getByRole("tablist")).toBeInTheDocument();
143
+ expect(getAllByRole("tab")).toHaveLength(tabs.length);
181
144
  });
182
145
 
183
- it('should support counters', () => {
146
+ it("should support counters", () => {
184
147
  const tabs = [
185
- { name: 'One', counter: 999 },
186
- { name: 'Two' },
187
- { name: 'Three', counter: 3333 }
148
+ { name: "One", counter: 999 },
149
+ { name: "Two" },
150
+ { name: "Three", counter: 3333 }
188
151
  ];
189
152
 
190
153
  const { getByText } = render(
@@ -195,8 +158,8 @@ describe('<ResponsiveTabs />', () => {
195
158
  </ResponsiveTabs>
196
159
  );
197
160
 
198
- expect(getByText('999')).toBeInTheDocument();
199
- expect(getByText('3333')).toBeInTheDocument();
161
+ expect(getByText("999")).toBeInTheDocument();
162
+ expect(getByText("3333")).toBeInTheDocument();
200
163
  });
201
164
  });
202
165
  });
@@ -114,7 +114,6 @@ const delays = {
114
114
  class Snackbar extends React.Component {
115
115
  constructor(props) {
116
116
  super(props);
117
- this.state = { createdElement: null };
118
117
  autobind(this);
119
118
 
120
119
  this.timer = null;
@@ -124,12 +123,6 @@ class Snackbar extends React.Component {
124
123
  if (this.props.visible) {
125
124
  this.hideAfterDelay();
126
125
  }
127
-
128
- const randomId = Math.random().toString();
129
- const wrapperElement = document.createElement('div');
130
- wrapperElement.setAttribute('id', `modal${randomId}`);
131
- document.body.appendChild(wrapperElement);
132
- this.setState({ createdElement: wrapperElement });
133
126
  }
134
127
 
135
128
  componentDidUpdate(prevProps) {
@@ -139,10 +132,6 @@ class Snackbar extends React.Component {
139
132
  }
140
133
 
141
134
  componentWillUnmount() {
142
- this.state.createdElement.parentNode.removeChild(
143
- this.state.createdElement
144
- );
145
-
146
135
  window.clearTimeout(this.timer);
147
136
  }
148
137
 
@@ -170,10 +159,6 @@ class Snackbar extends React.Component {
170
159
  ...rest
171
160
  } = this.props;
172
161
 
173
- if (!this.state.createdElement) {
174
- return null;
175
- }
176
-
177
162
  return createPortal(
178
163
  <SlideUpLeft visible={visible} {...rest}>
179
164
  <SnackWrapper type={type} data-testid="snackwrapper">
@@ -205,7 +190,7 @@ class Snackbar extends React.Component {
205
190
  </ContentWrapper>
206
191
  </SnackWrapper>
207
192
  </SlideUpLeft>,
208
- this.state.createdElement
193
+ document.body
209
194
  );
210
195
  }
211
196
  }