@zohodesk/dot 1.0.0-temp-210.1 → 1.0.0-temp-211

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 (55) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +5 -0
  3. package/es/ActionButton/__tests__/ActionButton.spec.js +353 -2
  4. package/es/ActionButton/__tests__/__snapshots__/ActionButton.spec.js.snap +2633 -1
  5. package/es/Drawer/Drawer.js +2 -10
  6. package/es/Drawer/__tests__/Content.spec.js +24 -0
  7. package/es/Drawer/__tests__/Drawer.spec.js +130 -4
  8. package/es/Drawer/__tests__/Footer.spec.js +34 -0
  9. package/es/Drawer/__tests__/Header.spec.js +173 -0
  10. package/es/Drawer/__tests__/__snapshots__/Content.spec.js.snap +127 -0
  11. package/es/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +535 -2
  12. package/es/Drawer/__tests__/__snapshots__/Footer.spec.js.snap +1233 -0
  13. package/es/Drawer/__tests__/__snapshots__/Header.spec.js.snap +782 -0
  14. package/es/Drawer/props/defaultProps.js +1 -5
  15. package/es/Drawer/props/propTypes.js +1 -5
  16. package/es/FlipCard/__tests__/FlipCard.spec.js +606 -2
  17. package/es/FlipCard/__tests__/__snapshots__/FlipCard.spec.js.snap +6626 -1
  18. package/es/FreezeLayer/FreezeLayer.js +3 -11
  19. package/es/FreezeLayer/props/defaultProps.js +1 -5
  20. package/es/FreezeLayer/props/propTypes.js +1 -5
  21. package/es/Link/__tests__/Link.spec.js +123 -3
  22. package/es/Link/__tests__/__snapshots__/Link.spec.js.snap +142 -2
  23. package/es/dropdown/ToggleDropDown/ToggleDropDown.js +8 -2
  24. package/es/list/ListStencils/ListStencils.js +7 -2
  25. package/es/list/ListStencils/__tests__/ListStencils.spec.js +9 -0
  26. package/es/list/ListStencils/__tests__/__snapshots__/ListStencils.spec.js.snap +46 -0
  27. package/es/list/ListStencils/props/propTypes.js +3 -1
  28. package/lib/ActionButton/__tests__/ActionButton.spec.js +354 -1
  29. package/lib/ActionButton/__tests__/__snapshots__/ActionButton.spec.js.snap +2633 -1
  30. package/lib/Drawer/Drawer.js +2 -10
  31. package/lib/Drawer/__tests__/Content.spec.js +35 -0
  32. package/lib/Drawer/__tests__/Drawer.spec.js +132 -5
  33. package/lib/Drawer/__tests__/Footer.spec.js +41 -0
  34. package/lib/Drawer/__tests__/Header.spec.js +192 -0
  35. package/lib/Drawer/__tests__/__snapshots__/Content.spec.js.snap +127 -0
  36. package/lib/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +535 -2
  37. package/lib/Drawer/__tests__/__snapshots__/Footer.spec.js.snap +1233 -0
  38. package/lib/Drawer/__tests__/__snapshots__/Header.spec.js.snap +782 -0
  39. package/lib/Drawer/props/defaultProps.js +1 -5
  40. package/lib/Drawer/props/propTypes.js +1 -5
  41. package/lib/FlipCard/__tests__/FlipCard.spec.js +613 -1
  42. package/lib/FlipCard/__tests__/__snapshots__/FlipCard.spec.js.snap +6626 -1
  43. package/lib/FreezeLayer/FreezeLayer.js +3 -11
  44. package/lib/FreezeLayer/props/defaultProps.js +1 -5
  45. package/lib/FreezeLayer/props/propTypes.js +1 -5
  46. package/lib/Link/__tests__/Link.spec.js +130 -4
  47. package/lib/Link/__tests__/__snapshots__/Link.spec.js.snap +142 -2
  48. package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +12 -6
  49. package/lib/list/ListStencils/ListStencils.js +8 -2
  50. package/lib/list/ListStencils/__tests__/ListStencils.spec.js +9 -0
  51. package/lib/list/ListStencils/__tests__/__snapshots__/ListStencils.spec.js.snap +46 -0
  52. package/lib/list/ListStencils/props/propTypes.js +3 -1
  53. package/package.json +6 -6
  54. package/result.json +1 -0
  55. package/unittest/index.html +45 -0
@@ -21,11 +21,7 @@ export default function FreezeLayer(props) {
21
21
  forwardRef,
22
22
  isSvgMask,
23
23
  needAutoZindex,
24
- customStyle,
25
- onParentAnimateComplete,
26
- onChildAnimateComplete,
27
- postAnimateParentStyles,
28
- postAnimateChildStyles
24
+ customStyle
29
25
  } = props;
30
26
  const finalStyle = mergeStyle(style, customStyle);
31
27
  const {
@@ -46,9 +42,7 @@ export default function FreezeLayer(props) {
46
42
  return /*#__PURE__*/React.createElement(VelocityAnimationGroup, {
47
43
  name: animationName && animationName,
48
44
  isActive: isActive,
49
- runOnMount: runOnMount,
50
- onEnterComplete: onParentAnimateComplete,
51
- postEnterStyles: postAnimateParentStyles
45
+ runOnMount: runOnMount
52
46
  }, /*#__PURE__*/React.createElement("div", {
53
47
  style: isActive && needAutoZindex ? {
54
48
  zIndex: `${getNextIndex()}`
@@ -64,9 +58,7 @@ export default function FreezeLayer(props) {
64
58
  component: Container,
65
59
  alignBox: "row",
66
60
  align: align,
67
- dataId: "reactFreezeLayer",
68
- onEnterComplete: onChildAnimateComplete,
69
- postEnterStyles: postAnimateChildStyles
61
+ dataId: "reactFreezeLayer"
70
62
  }, children) : isSvgMask ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : /*#__PURE__*/React.createElement(Container, {
71
63
  alignBox: "row",
72
64
  align: align,
@@ -5,9 +5,5 @@ export const defaultProps = {
5
5
  isSvgMask: false,
6
6
  customClass: '',
7
7
  customStyle: {},
8
- needAutoZindex: true,
9
- onParentAnimateComplete: () => {},
10
- onChildAnimateComplete: () => {},
11
- postAnimateParentStyles: {},
12
- postAnimateChildStyles: {}
8
+ needAutoZindex: true
13
9
  };
@@ -14,10 +14,6 @@ export const propTypes = {
14
14
  palette: PropTypes.oneOf(['dark', 'default', 'darkLight', 'plain', 'snow']),
15
15
  runOnMount: PropTypes.bool,
16
16
  customStyle: PropTypes.object,
17
- zIndex: PropTypes.oneOf(['3', '5', '7', '10']),
18
- onParentAnimateComplete: PropTypes.func,
19
- onChildAnimateComplete: PropTypes.func,
20
- postAnimateParentStyles: PropTypes.object,
21
- postAnimateChildStyles: PropTypes.object
17
+ zIndex: PropTypes.oneOf(['3', '5', '7', '10'])
22
18
  };
23
19
  export default propTypes;
@@ -1,11 +1,131 @@
1
1
  import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
  import Link from "../Link";
4
- describe('Link', () => {
5
- test('rendering the defult props', () => {
4
+ import LinkContext from "../LinkContext";
5
+ describe('Link Component Snapshot Tests', () => {
6
+ const targetOptions = ['_blank', '_self'];
7
+ const mockContextOptions = {
8
+ options: {
9
+ isLink: true,
10
+ constructURL: jest.fn((urlName, urlData) => `https://zoho.com/${urlName}/${urlData || ''}`)
11
+ }
12
+ };
13
+
14
+ const renderWithProvider = component => render( /*#__PURE__*/React.createElement(LinkContext.Provider, {
15
+ value: mockContextOptions
16
+ }, component));
17
+
18
+ test('renders with default props', () => {
6
19
  const {
7
20
  asFragment
8
- } = render( /*#__PURE__*/React.createElement(Link, null));
21
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, null));
22
+ expect(asFragment()).toMatchSnapshot();
23
+ });
24
+ test('renders with children content', () => {
25
+ const {
26
+ asFragment
27
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, null, "Click Here"));
28
+ expect(asFragment()).toMatchSnapshot();
29
+ });
30
+ test('renders with href prop', () => {
31
+ const {
32
+ asFragment
33
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
34
+ href: "https://zoho.com"
35
+ }));
36
+ expect(asFragment()).toMatchSnapshot();
37
+ });
38
+ test.each(targetOptions)('renders with target - %s', target => {
39
+ const {
40
+ asFragment
41
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
42
+ target: target
43
+ }));
44
+ expect(asFragment()).toMatchSnapshot();
45
+ });
46
+ test('renders with urlName and urlData using provider', () => {
47
+ const {
48
+ asFragment
49
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
50
+ urlName: "profile",
51
+ urlData: {
52
+ id: 123
53
+ }
54
+ }));
55
+ expect(mockContextOptions.options.constructURL).toHaveBeenCalledWith('profile', {
56
+ id: 123
57
+ });
58
+ expect(asFragment()).toMatchSnapshot();
59
+ });
60
+ test('renders with urlName and undefined urlData using provider', () => {
61
+ const {
62
+ asFragment
63
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
64
+ urlName: "profile"
65
+ }));
66
+ expect(mockContextOptions.options.constructURL).toHaveBeenCalledWith('profile', undefined);
67
+ expect(asFragment()).toMatchSnapshot();
68
+ });
69
+ test('renders with urlName and urlData as undefined using provider', () => {
70
+ const {
71
+ asFragment
72
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
73
+ urlName: undefined,
74
+ urlData: undefined
75
+ }));
76
+ expect(mockContextOptions.options.constructURL).toHaveBeenCalledWith(undefined, undefined);
77
+ expect(asFragment()).toMatchSnapshot();
78
+ });
79
+ test('renders with custom className', () => {
80
+ const {
81
+ asFragment
82
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
83
+ className: "custom-link"
84
+ }));
85
+ expect(asFragment()).toMatchSnapshot();
86
+ });
87
+ test('renders with title prop', () => {
88
+ const {
89
+ asFragment
90
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
91
+ title: "Example Title"
92
+ }));
93
+ expect(asFragment()).toMatchSnapshot();
94
+ });
95
+ test('renders with download attribute', () => {
96
+ const {
97
+ asFragment
98
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
99
+ download: true
100
+ }));
101
+ expect(asFragment()).toMatchSnapshot();
102
+ });
103
+ test('renders with rel attribute', () => {
104
+ const {
105
+ asFragment
106
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
107
+ rel: "noopener noreferrer"
108
+ }));
109
+ expect(asFragment()).toMatchSnapshot();
110
+ });
111
+ test('renders with dataId prop', () => {
112
+ const {
113
+ asFragment
114
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
115
+ dataId: "test-id"
116
+ }));
117
+ expect(asFragment()).toMatchSnapshot();
118
+ });
119
+ test('renders with customProps', () => {
120
+ const customProps = {
121
+ 'data-custom': 'customValue',
122
+ 'data-id': 'uniqueId'
123
+ };
124
+ const {
125
+ asFragment
126
+ } = renderWithProvider( /*#__PURE__*/React.createElement(Link, {
127
+ customProps: customProps
128
+ }));
9
129
  expect(asFragment()).toMatchSnapshot();
10
130
  });
11
131
  });
@@ -1,10 +1,150 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Link rendering the defult props 1`] = `
3
+ exports[`Link Component Snapshot Tests renders with children content 1`] = `
4
4
  <DocumentFragment>
5
5
  <a
6
6
  class="container "
7
- href="javascript:void(0);"
7
+ href="https://zoho.com/undefined/"
8
+ rel="noopener noreferrer"
9
+ >
10
+ Click Here
11
+ </a>
12
+ </DocumentFragment>
13
+ `;
14
+
15
+ exports[`Link Component Snapshot Tests renders with custom className 1`] = `
16
+ <DocumentFragment>
17
+ <a
18
+ class="container custom-link"
19
+ href="https://zoho.com/undefined/"
20
+ rel="noopener noreferrer"
21
+ />
22
+ </DocumentFragment>
23
+ `;
24
+
25
+ exports[`Link Component Snapshot Tests renders with customProps 1`] = `
26
+ <DocumentFragment>
27
+ <a
28
+ class="container "
29
+ data-custom="customValue"
30
+ data-id="uniqueId"
31
+ href="https://zoho.com/undefined/"
32
+ rel="noopener noreferrer"
33
+ />
34
+ </DocumentFragment>
35
+ `;
36
+
37
+ exports[`Link Component Snapshot Tests renders with dataId prop 1`] = `
38
+ <DocumentFragment>
39
+ <a
40
+ class="container "
41
+ data-id="test-id"
42
+ data-test-id="test-id"
43
+ href="https://zoho.com/undefined/"
44
+ rel="noopener noreferrer"
45
+ />
46
+ </DocumentFragment>
47
+ `;
48
+
49
+ exports[`Link Component Snapshot Tests renders with default props 1`] = `
50
+ <DocumentFragment>
51
+ <a
52
+ class="container "
53
+ href="https://zoho.com/undefined/"
54
+ rel="noopener noreferrer"
55
+ />
56
+ </DocumentFragment>
57
+ `;
58
+
59
+ exports[`Link Component Snapshot Tests renders with download attribute 1`] = `
60
+ <DocumentFragment>
61
+ <a
62
+ class="container "
63
+ download=""
64
+ href="https://zoho.com/undefined/"
65
+ rel="noopener noreferrer"
66
+ />
67
+ </DocumentFragment>
68
+ `;
69
+
70
+ exports[`Link Component Snapshot Tests renders with href prop 1`] = `
71
+ <DocumentFragment>
72
+ <a
73
+ class="container "
74
+ href="https://zoho.com"
75
+ rel="noopener noreferrer"
76
+ />
77
+ </DocumentFragment>
78
+ `;
79
+
80
+ exports[`Link Component Snapshot Tests renders with rel attribute 1`] = `
81
+ <DocumentFragment>
82
+ <a
83
+ class="container "
84
+ href="https://zoho.com/undefined/"
85
+ rel="noopener noreferrer"
86
+ />
87
+ </DocumentFragment>
88
+ `;
89
+
90
+ exports[`Link Component Snapshot Tests renders with target - _blank 1`] = `
91
+ <DocumentFragment>
92
+ <a
93
+ class="container "
94
+ href="https://zoho.com/undefined/"
95
+ rel="noopener noreferrer"
96
+ target="_blank"
97
+ />
98
+ </DocumentFragment>
99
+ `;
100
+
101
+ exports[`Link Component Snapshot Tests renders with target - _self 1`] = `
102
+ <DocumentFragment>
103
+ <a
104
+ class="container "
105
+ href="https://zoho.com/undefined/"
106
+ rel="noopener noreferrer"
107
+ target="_self"
108
+ />
109
+ </DocumentFragment>
110
+ `;
111
+
112
+ exports[`Link Component Snapshot Tests renders with title prop 1`] = `
113
+ <DocumentFragment>
114
+ <a
115
+ class="container "
116
+ data-title="Example Title"
117
+ href="https://zoho.com/undefined/"
118
+ rel="noopener noreferrer"
119
+ />
120
+ </DocumentFragment>
121
+ `;
122
+
123
+ exports[`Link Component Snapshot Tests renders with urlName and undefined urlData using provider 1`] = `
124
+ <DocumentFragment>
125
+ <a
126
+ class="container "
127
+ href="https://zoho.com/profile/"
128
+ rel="noopener noreferrer"
129
+ />
130
+ </DocumentFragment>
131
+ `;
132
+
133
+ exports[`Link Component Snapshot Tests renders with urlName and urlData as undefined using provider 1`] = `
134
+ <DocumentFragment>
135
+ <a
136
+ class="container "
137
+ href="https://zoho.com/undefined/"
138
+ rel="noopener noreferrer"
139
+ />
140
+ </DocumentFragment>
141
+ `;
142
+
143
+ exports[`Link Component Snapshot Tests renders with urlName and urlData using provider 1`] = `
144
+ <DocumentFragment>
145
+ <a
146
+ class="container "
147
+ href="https://zoho.com/profile/[object Object]"
8
148
  rel="noopener noreferrer"
9
149
  />
10
150
  </DocumentFragment>
@@ -717,7 +717,8 @@ export class ToggleDropDown extends Component {
717
717
  iconClass,
718
718
  title,
719
719
  disableTitle = '',
720
- isDisabled = false
720
+ isDisabled = false,
721
+ secondaryValue
721
722
  } = item;
722
723
  listIndex += 1;
723
724
  return iconName ? /*#__PURE__*/React.createElement(ListItemWithIcon, {
@@ -747,6 +748,7 @@ export class ToggleDropDown extends Component {
747
748
  ariaSelected: selectedId === item[idName],
748
749
  ariaLabel: item[keyName]
749
750
  },
751
+ secondaryValue: secondaryValue,
750
752
  ...ListItemWithIconProps
751
753
  }) : /*#__PURE__*/React.createElement(ListItem, {
752
754
  key: listIndex,
@@ -772,6 +774,7 @@ export class ToggleDropDown extends Component {
772
774
  ariaSelected: selectedId === item[idName],
773
775
  ariaLabel: item[keyName]
774
776
  },
777
+ secondaryValue: secondaryValue,
775
778
  ...ListItemProps
776
779
  });
777
780
  }));
@@ -786,7 +789,8 @@ export class ToggleDropDown extends Component {
786
789
  title,
787
790
  needDivider,
788
791
  isDisabled = false,
789
- disableTitle = ''
792
+ disableTitle = '',
793
+ secondaryValue
790
794
  } = item;
791
795
 
792
796
  if (!needDivider) {
@@ -824,6 +828,7 @@ export class ToggleDropDown extends Component {
824
828
  ariaSelected: selectedId === item[idName],
825
829
  ariaLabel: item[keyName]
826
830
  },
831
+ secondaryValue: secondaryValue,
827
832
  ...ListItemWithIconProps
828
833
  }) : /*#__PURE__*/React.createElement(ListItem, {
829
834
  key: listIndex,
@@ -849,6 +854,7 @@ export class ToggleDropDown extends Component {
849
854
  ariaSelected: selectedId === item[idName],
850
855
  ariaLabel: item[keyName]
851
856
  },
857
+ secondaryValue: secondaryValue,
852
858
  ...ListItemProps
853
859
  }));
854
860
  }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
@@ -11,10 +11,15 @@ import style from "./ListStencils.module.css";
11
11
  export default class ListStencils extends Component {
12
12
  render() {
13
13
  let {
14
- listType
14
+ listType,
15
+ testId,
16
+ customId
15
17
  } = this.props;
16
18
  return /*#__PURE__*/React.createElement("div", {
17
- className: `${style.container} ${style[listType]}`
19
+ className: `${style.container} ${style[listType]}`,
20
+ "data-test-id": testId ? testId + '_listStencils' : null,
21
+ "data-id": customId ? customId + '_listStencils' : null,
22
+ "aria-hidden": "true"
18
23
  }, /*#__PURE__*/React.createElement("div", {
19
24
  className: style.innerContainer
20
25
  }, /*#__PURE__*/React.createElement("div", {
@@ -8,4 +8,13 @@ describe('ListStencils', () => {
8
8
  } = render( /*#__PURE__*/React.createElement(ListStencils, null));
9
9
  expect(asFragment()).toMatchSnapshot();
10
10
  });
11
+ test('customId and testId', () => {
12
+ const {
13
+ asFragment
14
+ } = render( /*#__PURE__*/React.createElement(ListStencils, {
15
+ testId: "ticket",
16
+ customId: "contact"
17
+ }));
18
+ expect(asFragment()).toMatchSnapshot();
19
+ });
11
20
  });
@@ -1,8 +1,54 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`ListStencils customId and testId 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ aria-hidden="true"
7
+ class="container classic"
8
+ data-id="contact_listStencils"
9
+ data-test-id="ticket_listStencils"
10
+ >
11
+ <div
12
+ class="innerContainer"
13
+ >
14
+ <div
15
+ class="avatar"
16
+ >
17
+ <div
18
+ class="container circle clarge primary "
19
+ />
20
+ </div>
21
+ <div
22
+ class="detailsColumn"
23
+ >
24
+ <div
25
+ class="detailsInnerColumn"
26
+ >
27
+ <div
28
+ class="primaryRow"
29
+ >
30
+ <div
31
+ class="container rectangular default primary "
32
+ />
33
+ </div>
34
+ <div
35
+ class="secondaryRow"
36
+ >
37
+ <div
38
+ class="container rectangular medium primary "
39
+ />
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </DocumentFragment>
46
+ `;
47
+
3
48
  exports[`ListStencils rendering the defult props 1`] = `
4
49
  <DocumentFragment>
5
50
  <div
51
+ aria-hidden="true"
6
52
  class="container classic"
7
53
  >
8
54
  <div
@@ -1,4 +1,6 @@
1
1
  import PropTypes from 'prop-types';
2
2
  export const propTypes = {
3
- listType: PropTypes.oneOf(['classic', 'compact', 'superCompact'])
3
+ listType: PropTypes.oneOf(['classic', 'compact', 'superCompact']),
4
+ customId: PropTypes.string,
5
+ testId: PropTypes.string
4
6
  };