@zohodesk/dot 1.9.14 → 1.9.16

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 (68) hide show
  1. package/README.md +22 -0
  2. package/es/Drawer/Drawer.js +5 -1
  3. package/es/Drawer/props/propTypes.js +2 -0
  4. package/es/FormAction/FormAction.js +18 -5
  5. package/es/FormAction/__tests__/FormAction.spec.js +97 -3
  6. package/es/FormAction/__tests__/__snapshots__/FormAction.spec.js.snap +536 -1
  7. package/es/FormAction/props/propTypes.js +2 -0
  8. package/es/lookup/Lookup/Lookup.js +47 -18
  9. package/es/lookup/Lookup/Lookup.module.css +19 -0
  10. package/es/lookup/Lookup/__tests__/Lookup.spec.js +120 -4
  11. package/es/lookup/Lookup/__tests__/__snapshots__/Lookup.spec.js.snap +284 -2
  12. package/es/lookup/Lookup/props/defaultProps.js +3 -2
  13. package/es/lookup/Lookup/props/propTypes.js +12 -2
  14. package/es/lookup/Section/Section.js +14 -5
  15. package/es/lookup/Section/__tests__/Section.spec.js +41 -2
  16. package/es/lookup/Section/__tests__/__snapshots__/Section.spec.js.snap +131 -1
  17. package/es/lookup/Section/props/defaultProps.js +4 -0
  18. package/es/lookup/Section/props/propTypes.js +5 -0
  19. package/es/lookup/header/ModuleHeader/ModuleHeader.js +47 -18
  20. package/es/lookup/header/ModuleHeader/__tests__/ModuleHeader.spec.js +172 -3
  21. package/es/lookup/header/ModuleHeader/__tests__/__snapshots__/ModuleHeader.spec.js.snap +779 -3
  22. package/es/lookup/header/ModuleHeader/props/defaultProps.js +4 -0
  23. package/es/lookup/header/ModuleHeader/props/propTypes.js +21 -1
  24. package/es/lookup/header/Title/Title.js +3 -1
  25. package/es/lookup/header/Title/props/propTypes.js +1 -0
  26. package/es/version2/lookup/AlertHeader/AlertHeader.js +16 -7
  27. package/es/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +114 -3
  28. package/es/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +1695 -8
  29. package/es/version2/lookup/AlertHeader/css/cssJSLogic.js +8 -3
  30. package/es/version2/lookup/AlertHeader/props/defaultProps.js +3 -0
  31. package/es/version2/lookup/AlertHeader/props/propTypes.js +9 -0
  32. package/es/version2/lookup/AlertLookup/AlertLookup.js +11 -5
  33. package/es/version2/lookup/AlertLookup/props/defaultProps.js +1 -0
  34. package/es/version2/lookup/AlertLookup/props/propTypes.js +1 -0
  35. package/lib/Drawer/Drawer.js +5 -1
  36. package/lib/Drawer/props/propTypes.js +2 -0
  37. package/lib/FormAction/FormAction.js +18 -5
  38. package/lib/FormAction/__tests__/FormAction.spec.js +102 -2
  39. package/lib/FormAction/__tests__/__snapshots__/FormAction.spec.js.snap +536 -1
  40. package/lib/FormAction/props/propTypes.js +2 -0
  41. package/lib/lookup/Lookup/Lookup.js +50 -18
  42. package/lib/lookup/Lookup/Lookup.module.css +19 -0
  43. package/lib/lookup/Lookup/__tests__/Lookup.spec.js +120 -4
  44. package/lib/lookup/Lookup/__tests__/__snapshots__/Lookup.spec.js.snap +284 -2
  45. package/lib/lookup/Lookup/props/defaultProps.js +3 -2
  46. package/lib/lookup/Lookup/props/propTypes.js +15 -2
  47. package/lib/lookup/Section/Section.js +13 -5
  48. package/lib/lookup/Section/__tests__/Section.spec.js +40 -1
  49. package/lib/lookup/Section/__tests__/__snapshots__/Section.spec.js.snap +131 -1
  50. package/lib/lookup/Section/props/defaultProps.js +13 -0
  51. package/lib/lookup/Section/props/propTypes.js +6 -0
  52. package/lib/lookup/header/ModuleHeader/ModuleHeader.js +46 -24
  53. package/lib/lookup/header/ModuleHeader/__tests__/ModuleHeader.spec.js +177 -2
  54. package/lib/lookup/header/ModuleHeader/__tests__/__snapshots__/ModuleHeader.spec.js.snap +779 -3
  55. package/lib/lookup/header/ModuleHeader/props/defaultProps.js +6 -0
  56. package/lib/lookup/header/ModuleHeader/props/propTypes.js +25 -1
  57. package/lib/lookup/header/Title/Title.js +3 -1
  58. package/lib/lookup/header/Title/props/propTypes.js +1 -0
  59. package/lib/version2/lookup/AlertHeader/AlertHeader.js +18 -8
  60. package/lib/version2/lookup/AlertHeader/__tests__/AlertHeader.spec.js +113 -2
  61. package/lib/version2/lookup/AlertHeader/__tests__/__snapshots__/AlertHeader.spec.js.snap +1695 -8
  62. package/lib/version2/lookup/AlertHeader/css/cssJSLogic.js +7 -3
  63. package/lib/version2/lookup/AlertHeader/props/defaultProps.js +5 -0
  64. package/lib/version2/lookup/AlertHeader/props/propTypes.js +9 -0
  65. package/lib/version2/lookup/AlertLookup/AlertLookup.js +11 -8
  66. package/lib/version2/lookup/AlertLookup/props/defaultProps.js +1 -0
  67. package/lib/version2/lookup/AlertLookup/props/propTypes.js +1 -0
  68. package/package.json +8 -8
@@ -1,18 +1,134 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { cleanup, render } from '@testing-library/react';
3
3
  import Lookup from "../Lookup";
4
- describe('Lookup', () => {
5
- test('rendering the defult props', () => {
4
+ const SIZE_VALUES = ['small', 'xmedium', 'large', 'xlarge', 'full'];
5
+ const CHILD_ANIMATION_NAME_VALUES = ['expand'];
6
+ const PLACEMENT_VALUES = ['topCenter', 'center'];
7
+ afterEach(() => {
8
+ cleanup();
9
+ });
10
+ describe('Lookup snapshot - ', () => {
11
+ test('Render with default props', () => {
6
12
  const {
7
13
  asFragment
8
14
  } = render( /*#__PURE__*/React.createElement(Lookup, null));
9
15
  expect(asFragment()).toMatchSnapshot();
10
16
  });
11
- test('rendering isActive is true', () => {
17
+ test.each(SIZE_VALUES)('Render with size=%s', size => {
18
+ const {
19
+ asFragment
20
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
21
+ isActive: true,
22
+ size: size
23
+ }));
24
+ expect(asFragment()).toMatchSnapshot();
25
+ });
26
+ test.each(CHILD_ANIMATION_NAME_VALUES)('Render with childAnimationName=%s', childAnimationName => {
27
+ const {
28
+ asFragment
29
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
30
+ isActive: true,
31
+ childAnimationName: childAnimationName
32
+ }));
33
+ expect(asFragment()).toMatchSnapshot();
34
+ });
35
+ test.each(PLACEMENT_VALUES)('Render with placement=%s', placement => {
36
+ const {
37
+ asFragment
38
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
39
+ isActive: true,
40
+ placement: placement
41
+ }));
42
+ expect(asFragment()).toMatchSnapshot();
43
+ });
44
+ test('Render with isActive=true', () => {
45
+ const {
46
+ asFragment
47
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
48
+ isActive: true
49
+ }));
50
+ expect(asFragment()).toMatchSnapshot();
51
+ });
52
+ test('Render with isMinHeight=true', () => {
53
+ const {
54
+ asFragment
55
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
56
+ isActive: true,
57
+ isMinHeight: true
58
+ }));
59
+ expect(asFragment()).toMatchSnapshot();
60
+ });
61
+ test('Render with hasFreezeLayer=false', () => {
62
+ const {
63
+ asFragment
64
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
65
+ isActive: true,
66
+ hasFreezeLayer: false
67
+ }));
68
+ expect(asFragment()).toMatchSnapshot();
69
+ });
70
+ test('Render with children', () => {
12
71
  const {
13
72
  asFragment
14
73
  } = render( /*#__PURE__*/React.createElement(Lookup, {
15
74
  isActive: true
75
+ }, /*#__PURE__*/React.createElement("div", null, "Lookup child content")));
76
+ expect(asFragment()).toMatchSnapshot();
77
+ });
78
+ test('Render with custom classes', () => {
79
+ const {
80
+ asFragment
81
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
82
+ isActive: true,
83
+ customClass: "lookup-freeze-layer",
84
+ containerClass: "lookup-container",
85
+ lookupClass: "lookup-box"
86
+ }));
87
+ expect(asFragment()).toMatchSnapshot();
88
+ });
89
+ test('Render with customProps', () => {
90
+ const {
91
+ asFragment
92
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
93
+ isActive: true,
94
+ customProps: {
95
+ freezeLayerProps: {
96
+ palette: 'plain'
97
+ }
98
+ }
99
+ }));
100
+ expect(asFragment()).toMatchSnapshot();
101
+ });
102
+ test('Render with dataId', () => {
103
+ const {
104
+ asFragment
105
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
106
+ isActive: true,
107
+ dataId: "lookup-data-id"
108
+ }));
109
+ expect(asFragment()).toMatchSnapshot();
110
+ });
111
+ test('Render with htmlId', () => {
112
+ const {
113
+ asFragment
114
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
115
+ isActive: true,
116
+ htmlId: "lookup-html-id"
117
+ }));
118
+ expect(asFragment()).toMatchSnapshot();
119
+ });
120
+ test('Render with a11y attributes', () => {
121
+ const {
122
+ asFragment
123
+ } = render( /*#__PURE__*/React.createElement(Lookup, {
124
+ isActive: true,
125
+ a11y: {
126
+ role: 'region',
127
+ ariaLabelledby: 'lookup-title',
128
+ ariaDescribedby: 'lookup-description',
129
+ ariaLabel: 'Lookup Dialog',
130
+ ariaModal: true
131
+ }
16
132
  }));
17
133
  expect(asFragment()).toMatchSnapshot();
18
134
  });
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Lookup rendering isActive is true 1`] = `
3
+ exports[`Lookup snapshot - Render with a11y attributes 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
6
  class="container index5 snow"
@@ -17,4 +17,286 @@ exports[`Lookup rendering isActive is true 1`] = `
17
17
  </DocumentFragment>
18
18
  `;
19
19
 
20
- exports[`Lookup rendering the defult props 1`] = `<DocumentFragment />`;
20
+ exports[`Lookup snapshot - Render with childAnimationName=expand 1`] = `
21
+ <DocumentFragment>
22
+ <div
23
+ class="container index5 snow"
24
+ data-drag-parent="true"
25
+ style="z-index: 4;"
26
+ >
27
+ <div
28
+ class="flex cover rowdir hCenter"
29
+ data-id="reactFreezeLayer"
30
+ data-selector-id="container"
31
+ data-test-id="reactFreezeLayer"
32
+ />
33
+ </div>
34
+ </DocumentFragment>
35
+ `;
36
+
37
+ exports[`Lookup snapshot - Render with children 1`] = `
38
+ <DocumentFragment>
39
+ <div
40
+ class="container index5 snow"
41
+ data-drag-parent="true"
42
+ style="z-index: 4;"
43
+ >
44
+ <div
45
+ class="flex cover rowdir hCenter"
46
+ data-id="reactFreezeLayer"
47
+ data-selector-id="container"
48
+ data-test-id="reactFreezeLayer"
49
+ />
50
+ </div>
51
+ </DocumentFragment>
52
+ `;
53
+
54
+ exports[`Lookup snapshot - Render with custom classes 1`] = `
55
+ <DocumentFragment>
56
+ <div
57
+ class="container lookup-freeze-layer index5 snow"
58
+ data-drag-parent="true"
59
+ style="z-index: 4;"
60
+ >
61
+ <div
62
+ class="flex cover rowdir hCenter"
63
+ data-id="reactFreezeLayer"
64
+ data-selector-id="container"
65
+ data-test-id="reactFreezeLayer"
66
+ />
67
+ </div>
68
+ </DocumentFragment>
69
+ `;
70
+
71
+ exports[`Lookup snapshot - Render with customProps 1`] = `
72
+ <DocumentFragment>
73
+ <div
74
+ class="container index5 plain"
75
+ data-drag-parent="true"
76
+ style="z-index: 4;"
77
+ >
78
+ <div
79
+ class="flex cover rowdir hCenter"
80
+ data-id="reactFreezeLayer"
81
+ data-selector-id="container"
82
+ data-test-id="reactFreezeLayer"
83
+ />
84
+ </div>
85
+ </DocumentFragment>
86
+ `;
87
+
88
+ exports[`Lookup snapshot - Render with dataId 1`] = `
89
+ <DocumentFragment>
90
+ <div
91
+ class="container index5 snow"
92
+ data-drag-parent="true"
93
+ style="z-index: 4;"
94
+ >
95
+ <div
96
+ class="flex cover rowdir hCenter"
97
+ data-id="reactFreezeLayer"
98
+ data-selector-id="container"
99
+ data-test-id="reactFreezeLayer"
100
+ />
101
+ </div>
102
+ </DocumentFragment>
103
+ `;
104
+
105
+ exports[`Lookup snapshot - Render with default props 1`] = `<DocumentFragment />`;
106
+
107
+ exports[`Lookup snapshot - Render with hasFreezeLayer=false 1`] = `
108
+ <DocumentFragment>
109
+ <div
110
+ class="overlayLayer flex cover rowdir hCenter"
111
+ data-id="fldValue"
112
+ data-selector-id="container"
113
+ data-test-id="fldValue"
114
+ >
115
+ <div
116
+ aria-modal="true"
117
+ class="box mediumSize topCenterBox "
118
+ data-a11y-need-focus-style="false"
119
+ role="dialog"
120
+ tabindex="-1"
121
+ >
122
+ <div
123
+ class="coverwrap containerWidth undefined flex coldir"
124
+ data-drag-container="true"
125
+ data-id="containerComponent"
126
+ data-selector-id="container"
127
+ data-test-id="containerComponent"
128
+ />
129
+ </div>
130
+ </div>
131
+ </DocumentFragment>
132
+ `;
133
+
134
+ exports[`Lookup snapshot - Render with htmlId 1`] = `
135
+ <DocumentFragment>
136
+ <div
137
+ class="container index5 snow"
138
+ data-drag-parent="true"
139
+ style="z-index: 4;"
140
+ >
141
+ <div
142
+ class="flex cover rowdir hCenter"
143
+ data-id="reactFreezeLayer"
144
+ data-selector-id="container"
145
+ data-test-id="reactFreezeLayer"
146
+ />
147
+ </div>
148
+ </DocumentFragment>
149
+ `;
150
+
151
+ exports[`Lookup snapshot - Render with isActive=true 1`] = `
152
+ <DocumentFragment>
153
+ <div
154
+ class="container index5 snow"
155
+ data-drag-parent="true"
156
+ style="z-index: 4;"
157
+ >
158
+ <div
159
+ class="flex cover rowdir hCenter"
160
+ data-id="reactFreezeLayer"
161
+ data-selector-id="container"
162
+ data-test-id="reactFreezeLayer"
163
+ />
164
+ </div>
165
+ </DocumentFragment>
166
+ `;
167
+
168
+ exports[`Lookup snapshot - Render with isMinHeight=true 1`] = `
169
+ <DocumentFragment>
170
+ <div
171
+ class="container index5 snow"
172
+ data-drag-parent="true"
173
+ style="z-index: 4;"
174
+ >
175
+ <div
176
+ class="flex cover rowdir hCenter"
177
+ data-id="reactFreezeLayer"
178
+ data-selector-id="container"
179
+ data-test-id="reactFreezeLayer"
180
+ />
181
+ </div>
182
+ </DocumentFragment>
183
+ `;
184
+
185
+ exports[`Lookup snapshot - Render with placement=center 1`] = `
186
+ <DocumentFragment>
187
+ <div
188
+ class="container index5 snow"
189
+ data-drag-parent="true"
190
+ style="z-index: 4;"
191
+ >
192
+ <div
193
+ class="flex cover rowdir both"
194
+ data-id="reactFreezeLayer"
195
+ data-selector-id="container"
196
+ data-test-id="reactFreezeLayer"
197
+ />
198
+ </div>
199
+ </DocumentFragment>
200
+ `;
201
+
202
+ exports[`Lookup snapshot - Render with placement=topCenter 1`] = `
203
+ <DocumentFragment>
204
+ <div
205
+ class="container index5 snow"
206
+ data-drag-parent="true"
207
+ style="z-index: 4;"
208
+ >
209
+ <div
210
+ class="flex cover rowdir hCenter"
211
+ data-id="reactFreezeLayer"
212
+ data-selector-id="container"
213
+ data-test-id="reactFreezeLayer"
214
+ />
215
+ </div>
216
+ </DocumentFragment>
217
+ `;
218
+
219
+ exports[`Lookup snapshot - Render with size=full 1`] = `
220
+ <DocumentFragment>
221
+ <div
222
+ class="container index5 snow"
223
+ data-drag-parent="true"
224
+ style="z-index: 4;"
225
+ >
226
+ <div
227
+ class="flex cover rowdir hCenter"
228
+ data-id="reactFreezeLayer"
229
+ data-selector-id="container"
230
+ data-test-id="reactFreezeLayer"
231
+ />
232
+ </div>
233
+ </DocumentFragment>
234
+ `;
235
+
236
+ exports[`Lookup snapshot - Render with size=large 1`] = `
237
+ <DocumentFragment>
238
+ <div
239
+ class="container index5 snow"
240
+ data-drag-parent="true"
241
+ style="z-index: 4;"
242
+ >
243
+ <div
244
+ class="flex cover rowdir hCenter"
245
+ data-id="reactFreezeLayer"
246
+ data-selector-id="container"
247
+ data-test-id="reactFreezeLayer"
248
+ />
249
+ </div>
250
+ </DocumentFragment>
251
+ `;
252
+
253
+ exports[`Lookup snapshot - Render with size=small 1`] = `
254
+ <DocumentFragment>
255
+ <div
256
+ class="container index5 snow"
257
+ data-drag-parent="true"
258
+ style="z-index: 4;"
259
+ >
260
+ <div
261
+ class="flex cover rowdir hCenter"
262
+ data-id="reactFreezeLayer"
263
+ data-selector-id="container"
264
+ data-test-id="reactFreezeLayer"
265
+ />
266
+ </div>
267
+ </DocumentFragment>
268
+ `;
269
+
270
+ exports[`Lookup snapshot - Render with size=xlarge 1`] = `
271
+ <DocumentFragment>
272
+ <div
273
+ class="container index5 snow"
274
+ data-drag-parent="true"
275
+ style="z-index: 4;"
276
+ >
277
+ <div
278
+ class="flex cover rowdir hCenter"
279
+ data-id="reactFreezeLayer"
280
+ data-selector-id="container"
281
+ data-test-id="reactFreezeLayer"
282
+ />
283
+ </div>
284
+ </DocumentFragment>
285
+ `;
286
+
287
+ exports[`Lookup snapshot - Render with size=xmedium 1`] = `
288
+ <DocumentFragment>
289
+ <div
290
+ class="container index5 snow"
291
+ data-drag-parent="true"
292
+ style="z-index: 4;"
293
+ >
294
+ <div
295
+ class="flex cover rowdir hCenter"
296
+ data-id="reactFreezeLayer"
297
+ data-selector-id="container"
298
+ data-test-id="reactFreezeLayer"
299
+ />
300
+ </div>
301
+ </DocumentFragment>
302
+ `;
@@ -2,8 +2,9 @@ export const defaultProps = {
2
2
  size: 'medium',
3
3
  customClass: '',
4
4
  a11y: {},
5
- childAnimationName: 'flyDown',
6
5
  needFocusScope: false,
7
6
  customProps: {},
8
- isMinHeight: false
7
+ isMinHeight: false,
8
+ placement: 'topCenter',
9
+ hasFreezeLayer: true
9
10
  };
@@ -1,4 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
+ import FocusScopePropTypes from '@zohodesk/a11y/es/FocusScope/props/propTypes';
3
+ import VelocityAnimationGroupPropTypes from '@zohodesk/components/es/VelocityAnimation/VelocityAnimationGroup/props/propTypes';
4
+ import FreezeLayerPropTypes from "../../../FreezeLayer/props/propTypes";
2
5
  export const propTypes = {
3
6
  children: PropTypes.node,
4
7
  customClass: PropTypes.string,
@@ -8,6 +11,7 @@ export const propTypes = {
8
11
  htmlId: PropTypes.string,
9
12
  a11y: PropTypes.shape({
10
13
  role: PropTypes.string,
14
+ ariaLabel: PropTypes.string,
11
15
  ariaLabelledby: PropTypes.string,
12
16
  ariaDescribedby: PropTypes.string,
13
17
  ariaModal: PropTypes.bool
@@ -15,11 +19,17 @@ export const propTypes = {
15
19
  onKeyDown: PropTypes.func,
16
20
  childAnimationName: PropTypes.oneOf(['expand', 'flyDown']),
17
21
  needFocusScope: PropTypes.bool,
18
- customProps: PropTypes.object,
22
+ customProps: PropTypes.shape({
23
+ focusScopeProps: PropTypes.shape(FocusScopePropTypes),
24
+ freezeLayerProps: PropTypes.shape(FreezeLayerPropTypes),
25
+ velocityAnimationProps: PropTypes.shape(VelocityAnimationGroupPropTypes)
26
+ }),
19
27
  forwardRef: PropTypes.object,
20
28
  onClick: PropTypes.func,
21
29
  onClose: PropTypes.func,
22
30
  isMinHeight: PropTypes.bool,
23
31
  containerClass: PropTypes.string,
24
- lookupClass: PropTypes.string
32
+ lookupClass: PropTypes.string,
33
+ placement: PropTypes.oneOf(['topCenter', 'center']),
34
+ hasFreezeLayer: PropTypes.bool
25
35
  };
@@ -1,5 +1,8 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  import React, { Component } from 'react';
2
4
  import { propTypes } from "./props/propTypes";
5
+ import { defaultProps } from "./props/defaultProps";
3
6
  import { Container, Box } from '@zohodesk/components/es/Layout';
4
7
  import style from "./LookupSection.module.css";
5
8
  export default class Section extends Component {
@@ -10,15 +13,21 @@ export default class Section extends Component {
10
13
  render() {
11
14
  let {
12
15
  alignBox,
13
- className
16
+ className,
17
+ customProps
14
18
  } = this.props;
15
- return /*#__PURE__*/React.createElement(Container, {
19
+ let {
20
+ container: containerProps,
21
+ wrapper: wrapperProps
22
+ } = customProps;
23
+ return /*#__PURE__*/React.createElement(Container, _extends({}, containerProps, {
16
24
  alignBox: alignBox,
17
25
  className: `${style.section} ${className ? className : ''}`
18
- }, /*#__PURE__*/React.createElement(Box, {
26
+ }), /*#__PURE__*/React.createElement(Box, _extends({
19
27
  flexible: true
20
- }, this.props.children));
28
+ }, wrapperProps), this.props.children));
21
29
  }
22
30
 
23
31
  }
24
- Section.propTypes = propTypes;
32
+ Section.propTypes = propTypes;
33
+ Section.defaultProps = defaultProps;
@@ -1,11 +1,50 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, cleanup } from '@testing-library/react';
3
3
  import Section from "../Section";
4
+ afterEach(cleanup);
5
+ const alignBoxValues = ['row', 'column', 'row-reverse', 'column-reverse'];
4
6
  describe('Section', () => {
5
- test('rendering the defult props', () => {
7
+ test('Render with default props', () => {
6
8
  const {
7
9
  asFragment
8
10
  } = render( /*#__PURE__*/React.createElement(Section, null));
9
11
  expect(asFragment()).toMatchSnapshot();
10
12
  });
13
+ test.each(alignBoxValues)('Render with alignBox as %s', alignBox => {
14
+ const {
15
+ asFragment
16
+ } = render( /*#__PURE__*/React.createElement(Section, {
17
+ alignBox: alignBox
18
+ }));
19
+ expect(asFragment()).toMatchSnapshot();
20
+ });
21
+ test('Render with className', () => {
22
+ const {
23
+ asFragment
24
+ } = render( /*#__PURE__*/React.createElement(Section, {
25
+ className: "custom-class"
26
+ }));
27
+ expect(asFragment()).toMatchSnapshot();
28
+ });
29
+ test('Render with children', () => {
30
+ const {
31
+ asFragment
32
+ } = render( /*#__PURE__*/React.createElement(Section, null, /*#__PURE__*/React.createElement("div", null, "child content")));
33
+ expect(asFragment()).toMatchSnapshot();
34
+ });
35
+ test('Render with customProps', () => {
36
+ const {
37
+ asFragment
38
+ } = render( /*#__PURE__*/React.createElement(Section, {
39
+ customProps: {
40
+ container: {
41
+ align: 'vertical'
42
+ },
43
+ wrapper: {
44
+ scroll: 'vertical'
45
+ }
46
+ }
47
+ }));
48
+ expect(asFragment()).toMatchSnapshot();
49
+ });
11
50
  });
@@ -1,6 +1,136 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Section rendering the defult props 1`] = `
3
+ exports[`Section Render with alignBox as column 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="section flex cover coldir"
7
+ data-id="containerComponent"
8
+ data-selector-id="container"
9
+ data-test-id="containerComponent"
10
+ >
11
+ <div
12
+ class="grow basis shrinkOff"
13
+ data-id="boxComponent"
14
+ data-selector-id="box"
15
+ data-test-id="boxComponent"
16
+ />
17
+ </div>
18
+ </DocumentFragment>
19
+ `;
20
+
21
+ exports[`Section Render with alignBox as column-reverse 1`] = `
22
+ <DocumentFragment>
23
+ <div
24
+ class="section flex cover colReverse"
25
+ data-id="containerComponent"
26
+ data-selector-id="container"
27
+ data-test-id="containerComponent"
28
+ >
29
+ <div
30
+ class="grow basis shrinkOff"
31
+ data-id="boxComponent"
32
+ data-selector-id="box"
33
+ data-test-id="boxComponent"
34
+ />
35
+ </div>
36
+ </DocumentFragment>
37
+ `;
38
+
39
+ exports[`Section Render with alignBox as row 1`] = `
40
+ <DocumentFragment>
41
+ <div
42
+ class="section flex cover rowdir"
43
+ data-id="containerComponent"
44
+ data-selector-id="container"
45
+ data-test-id="containerComponent"
46
+ >
47
+ <div
48
+ class="grow basis shrinkOff"
49
+ data-id="boxComponent"
50
+ data-selector-id="box"
51
+ data-test-id="boxComponent"
52
+ />
53
+ </div>
54
+ </DocumentFragment>
55
+ `;
56
+
57
+ exports[`Section Render with alignBox as row-reverse 1`] = `
58
+ <DocumentFragment>
59
+ <div
60
+ class="section flex cover rowReverse"
61
+ data-id="containerComponent"
62
+ data-selector-id="container"
63
+ data-test-id="containerComponent"
64
+ >
65
+ <div
66
+ class="grow basis shrinkOff"
67
+ data-id="boxComponent"
68
+ data-selector-id="box"
69
+ data-test-id="boxComponent"
70
+ />
71
+ </div>
72
+ </DocumentFragment>
73
+ `;
74
+
75
+ exports[`Section Render with children 1`] = `
76
+ <DocumentFragment>
77
+ <div
78
+ class="section flex cover coldir"
79
+ data-id="containerComponent"
80
+ data-selector-id="container"
81
+ data-test-id="containerComponent"
82
+ >
83
+ <div
84
+ class="grow basis shrinkOff"
85
+ data-id="boxComponent"
86
+ data-selector-id="box"
87
+ data-test-id="boxComponent"
88
+ >
89
+ <div>
90
+ child content
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </DocumentFragment>
95
+ `;
96
+
97
+ exports[`Section Render with className 1`] = `
98
+ <DocumentFragment>
99
+ <div
100
+ class="section custom-class flex cover coldir"
101
+ data-id="containerComponent"
102
+ data-selector-id="container"
103
+ data-test-id="containerComponent"
104
+ >
105
+ <div
106
+ class="grow basis shrinkOff"
107
+ data-id="boxComponent"
108
+ data-selector-id="box"
109
+ data-test-id="boxComponent"
110
+ />
111
+ </div>
112
+ </DocumentFragment>
113
+ `;
114
+
115
+ exports[`Section Render with customProps 1`] = `
116
+ <DocumentFragment>
117
+ <div
118
+ class="section flex cover coldir vCenter"
119
+ data-id="containerComponent"
120
+ data-selector-id="container"
121
+ data-test-id="containerComponent"
122
+ >
123
+ <div
124
+ class="grow basis shrinkOff scrolly"
125
+ data-id="boxComponent"
126
+ data-selector-id="box"
127
+ data-test-id="boxComponent"
128
+ />
129
+ </div>
130
+ </DocumentFragment>
131
+ `;
132
+
133
+ exports[`Section Render with default props 1`] = `
4
134
  <DocumentFragment>
5
135
  <div
6
136
  class="section flex cover coldir"