@zohodesk/components 1.0.0-alpha-264 → 1.0.0-alpha-266

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 (103) hide show
  1. package/README.md +12 -0
  2. package/assets/Appearance/dark/mode/darkMode.module.css +181 -180
  3. package/assets/Appearance/dark/themes/blue/blueDarkCTAModifyCategory.module.css +452 -0
  4. package/assets/Appearance/dark/themes/blue/blueDarkCTATheme.module.css +31 -31
  5. package/assets/Appearance/dark/themes/green/greenDarkCTAModifyCategory.module.css +452 -0
  6. package/assets/Appearance/dark/themes/green/greenDarkCTATheme.module.css +30 -30
  7. package/assets/Appearance/dark/themes/orange/orangeDarkCTAModifyCategory.module.css +452 -0
  8. package/assets/Appearance/dark/themes/orange/orangeDarkCTATheme.module.css +30 -30
  9. package/assets/Appearance/dark/themes/red/redDarkCTAModifyCategory.module.css +452 -0
  10. package/assets/Appearance/dark/themes/red/redDarkCTATheme.module.css +30 -30
  11. package/assets/Appearance/dark/themes/yellow/yellowDarkCTAModifyCategory.module.css +452 -0
  12. package/assets/Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css +30 -30
  13. package/assets/Appearance/default/mode/defaultMode.module.css +177 -176
  14. package/assets/Appearance/default/themes/blue/blueDefaultCTAModifyCategory.module.css +452 -0
  15. package/assets/Appearance/default/themes/blue/blueDefaultCTATheme.module.css +31 -31
  16. package/assets/Appearance/default/themes/green/greenDefaultCTAModifyCategory.module.css +452 -0
  17. package/assets/Appearance/default/themes/green/greenDefaultCTATheme.module.css +30 -30
  18. package/assets/Appearance/default/themes/orange/orangeDefaultCTAModifyCategory.module.css +452 -0
  19. package/assets/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css +30 -30
  20. package/assets/Appearance/default/themes/red/redDefaultCTAModifyCategory.module.css +452 -0
  21. package/assets/Appearance/default/themes/red/redDefaultCTATheme.module.css +30 -30
  22. package/assets/Appearance/default/themes/yellow/yellowDefaultCTAModifyCategory.module.css +452 -0
  23. package/assets/Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css +30 -30
  24. package/assets/Appearance/pureDark/mode/pureDarkMode.module.css +182 -181
  25. package/assets/Appearance/pureDark/themes/blue/bluePureDarkCTAModifyCategory.module.css +452 -0
  26. package/assets/Appearance/pureDark/themes/blue/bluePureDarkCTATheme.module.css +31 -31
  27. package/assets/Appearance/pureDark/themes/green/greenPureDarkCTAModifyCategory.module.css +452 -0
  28. package/assets/Appearance/pureDark/themes/green/greenPureDarkCTATheme.module.css +30 -30
  29. package/assets/Appearance/pureDark/themes/orange/orangePureDarkCTAModifyCategory.module.css +452 -0
  30. package/assets/Appearance/pureDark/themes/orange/orangePureDarkCTATheme.module.css +30 -30
  31. package/assets/Appearance/pureDark/themes/red/redPureDarkCTAModifyCategory.module.css +452 -0
  32. package/assets/Appearance/pureDark/themes/red/redPureDarkCTATheme.module.css +30 -30
  33. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkCTAModifyCategory.module.css +452 -0
  34. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkCTATheme.module.css +30 -30
  35. package/assets/Contrast/darkContrastLightness.module.css +39 -0
  36. package/assets/Contrast/defaultContrastLightness.module.css +39 -0
  37. package/assets/Contrast/pureDarkContrastLightness.module.css +39 -0
  38. package/es/AppContainer/AppContainer.js +1 -0
  39. package/es/Avatar/Avatar.module.css +48 -13
  40. package/es/Button/Button.js +44 -47
  41. package/es/Button/{Button.module.css → css/Button.module.css} +6 -6
  42. package/es/Button/css/cssJSLogic.js +53 -0
  43. package/es/Button/index.js +2 -0
  44. package/es/Button/props/propTypes.js +3 -1
  45. package/es/Buttongroup/Buttongroup.module.css +36 -18
  46. package/es/DateTime/DateTime.js +26 -65
  47. package/es/DateTime/DateTime.module.css +1 -1
  48. package/es/DateTime/dateFormatUtils/dateFormats.js +43 -0
  49. package/es/DateTime/dateFormatUtils/index.js +27 -0
  50. package/es/DateTime/props/propTypes.js +2 -1
  51. package/es/DropBox/DropBox.js +3 -5
  52. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +6 -10
  53. package/es/DropBox/css/DropBox.module.css +1 -1
  54. package/es/MultiSelect/AdvancedMultiSelect.js +0 -2
  55. package/es/MultiSelect/MultiSelect.js +0 -3
  56. package/es/Popup/Popup.js +2 -3
  57. package/es/Ribbon/Ribbon.module.css +102 -24
  58. package/es/Switch/Switch.module.css +26 -9
  59. package/es/Tab/Tab.js +1 -1
  60. package/es/Tab/Tabs.js +10 -5
  61. package/es/Tab/Tabs.module.css +6 -2
  62. package/es/Tab/__tests__/Tab.spec.js +5 -11
  63. package/es/Tab/props/propTypes.js +1 -1
  64. package/es/Tooltip/Tooltip.module.css +28 -3
  65. package/es/common/a11y.module.css +3 -3
  66. package/es/common/boxShadow.module.css +34 -0
  67. package/es/utils/Common.js +4 -0
  68. package/es/utils/css/mergeStyle.js +23 -10
  69. package/lib/AppContainer/AppContainer.js +1 -0
  70. package/lib/Avatar/Avatar.module.css +48 -13
  71. package/lib/Button/Button.js +43 -72
  72. package/lib/Button/{Button.module.css → css/Button.module.css} +6 -6
  73. package/lib/Button/css/cssJSLogic.js +40 -0
  74. package/lib/Button/index.js +20 -0
  75. package/lib/Button/props/propTypes.js +5 -2
  76. package/lib/Buttongroup/Buttongroup.module.css +36 -18
  77. package/lib/DateTime/DateTime.js +25 -61
  78. package/lib/DateTime/DateTime.module.css +1 -1
  79. package/lib/DateTime/dateFormatUtils/dateFormats.js +51 -0
  80. package/lib/DateTime/dateFormatUtils/index.js +31 -3
  81. package/lib/DateTime/props/propTypes.js +8 -1
  82. package/lib/DropBox/DropBox.js +3 -5
  83. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +6 -10
  84. package/lib/DropBox/css/DropBox.module.css +1 -1
  85. package/lib/MultiSelect/AdvancedMultiSelect.js +0 -1
  86. package/lib/MultiSelect/MultiSelect.js +0 -2
  87. package/lib/Popup/Popup.js +1 -2
  88. package/lib/Ribbon/Ribbon.module.css +102 -24
  89. package/lib/Switch/Switch.module.css +26 -9
  90. package/lib/Tab/Tabs.js +7 -2
  91. package/lib/Tab/Tabs.module.css +6 -2
  92. package/lib/Tab/__tests__/Tab.spec.js +17 -22
  93. package/lib/Tab/props/propTypes.js +1 -1
  94. package/lib/Tooltip/Tooltip.module.css +28 -3
  95. package/lib/common/a11y.module.css +3 -3
  96. package/lib/common/boxShadow.module.css +34 -0
  97. package/lib/utils/Common.js +7 -1
  98. package/lib/utils/css/mergeStyle.js +23 -10
  99. package/package.json +8 -8
  100. package/es/Button/__tests__/Button.spec.js +0 -190
  101. package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -191
  102. package/lib/Button/__tests__/Button.spec.js +0 -193
  103. package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -191
@@ -1,6 +1,7 @@
1
1
  .tooltiptext {
2
2
  position: fixed;
3
- z-index: 9999999; /*Hook for editor alert*/
3
+ z-index: 9999999;
4
+ /*Hook for editor alert*/
4
5
  pointer-events: none;
5
6
  box-shadow: 0 4px 12px 0 var(--zdt_tooltip_default_box_shadow);
6
7
  border-radius: var(--zd_size4);
@@ -9,6 +10,7 @@
9
10
  }[dir=rtl] .tooltiptext {
10
11
  animation: tooltip-grow var(--zd_transition7) cubic-bezier(0.175, 0.885, 0.32, 1.15);
11
12
  }
13
+
12
14
  .tooltipcont {
13
15
  color: var(--zdt_tooltip_default_text);
14
16
  font-size: var(--zd_font_size13);
@@ -24,9 +26,11 @@
24
26
  border-color: transparent;
25
27
  border-radius: var(--zd_size4);
26
28
  }
29
+
27
30
  .tooltipWrapCont {
28
31
  white-space: pre-wrap;
29
32
  }
33
+
30
34
  .tooltipNormalCont {
31
35
  white-space: normal;
32
36
  }
@@ -36,6 +40,7 @@
36
40
  top: 0;
37
41
  border-top-left-radius: 3px;
38
42
  }
43
+
39
44
  .arrowUp,
40
45
  .arrowDown {
41
46
  width: 11px;
@@ -44,10 +49,15 @@
44
49
  border-left: solid 6px var(--zdt_tooltip_default_bg);
45
50
  border-right: solid 6px transparent;
46
51
  border-bottom: solid 6px transparent;
52
+ box-shadow: 0 4px 12px 0 var(--zdt_tooltip_default_box_shadow);
53
+ z-index: -1;
47
54
  }
55
+
48
56
  .arrowDown {
49
- margin-top: -4px !important; /* put important because of '.wms-mainui *' have margin: 0; */
57
+ margin-top: -4px !important;
58
+ /* put important because of '.wms-mainui *' have margin: 0; */
50
59
  }
60
+
51
61
  .arrowLeft,
52
62
  .arrowRight {
53
63
  width: 11px;
@@ -56,22 +66,30 @@
56
66
  border-left: solid 6px var(--zdt_tooltip_default_bg);
57
67
  border-right: solid 6px transparent;
58
68
  border-bottom: solid 6px transparent;
69
+ box-shadow: 0 4px 12px 0 var(--zdt_tooltip_default_box_shadow);
70
+ z-index: -1;
59
71
  }
72
+
60
73
  .arrowRight {
61
74
  margin-left: -2px;
62
75
  }
76
+
63
77
  .arrowLeft {
64
78
  margin-left: 1px;
65
79
  }
80
+
66
81
  .arrowUp {
67
82
  transform: rotate(45deg);
68
83
  }
84
+
69
85
  .arrowDown {
70
86
  transform: rotate(225deg);
71
87
  }
88
+
72
89
  .arrowLeft {
73
90
  transform: rotate(315deg) translateY(-50%);
74
91
  }
92
+
75
93
  .arrowRight {
76
94
  transform: rotate(135deg) translateY(50%);
77
95
  }
@@ -79,31 +97,38 @@
79
97
  from {
80
98
  opacity: 0;
81
99
  }
100
+
82
101
  to {
83
102
  opacity: 1;
84
103
  }
85
104
  }
105
+
86
106
  @-webkit-keyframes tooltip-grow {
87
107
  from {
88
108
  opacity: 0;
89
109
  }
110
+
90
111
  to {
91
112
  opacity: 1;
92
113
  }
93
114
  }
115
+
94
116
  @-moz-keyframes tooltip-grow {
95
117
  from {
96
118
  opacity: 0;
97
119
  }
120
+
98
121
  to {
99
122
  opacity: 1;
100
123
  }
101
124
  }
125
+
102
126
  @-ms-keyframes tooltip-grow {
103
127
  from {
104
128
  opacity: 0;
105
129
  }
130
+
106
131
  to {
107
132
  opacity: 1;
108
133
  }
109
- }
134
+ }
@@ -1,4 +1,4 @@
1
- :root {
2
- --lib_a11y_focusScope_focus_border:var(--zdt_a11y_focusScope_focus_border);
3
- --lib_a11y_focusScope_focus_bg:var(--zdt_listitem_highlight_bg);
1
+ :root {
2
+ --lib_a11y_focusScope_focus_border: var(--zdt_a11y_focusScope_focus_border);
3
+ --lib_a11y_focusScope_focus_bg: var(--zdt_listitem_highlight_bg);
4
4
  }
@@ -0,0 +1,34 @@
1
+ :root {
2
+ /* avatar */
3
+ --zd_bs_avatar_black: var(--zd_bs_contrast_outline, inset 0px 0px 5px var(--avatar_boxshadow));
4
+ --zd_bs_avatar_white: var(--zd_bs_contrast_outline, inset 0px 0px 11px var(--avatar_boxshadow));
5
+
6
+ /* button */
7
+ --zd_bs_button_primary: var(--zd_bs_contrast_outline, 0 3px 10px var(--zdt_button_primary_box_shadow));
8
+ --zd_bs_button_danger: var(--zd_bs_contrast_outline, 0 3px 10px var(--zdt_button_danger_box_shadow));
9
+
10
+ /* button group */
11
+ --zd_bs_buttongroup_footer: var(--zd_bs_contrast_outline, 0 -4px 5px -3px var(--zdt_buttongroup_footer_box_shadow));
12
+
13
+ /* dropbox */
14
+ --zd_bs_dropbox_default: var(--zd_bs_contrast_outline, 4px 3px 30px var(--zdt_dropbox_default_box_shadow));
15
+ --zd_bs_dropbox_top: var(--zd_bs_contrast_outline, 0 -3px 30px var(--zdt_dropbox_default_box_shadow));
16
+ --zd_bs_dropbox_left: var(--zd_bs_contrast_outline, -4px 0 30px var(--zdt_dropbox_default_box_shadow));
17
+ --zd_bs_dropbox_right: var(--zd_bs_contrast_outline, 4px 0 30px var(--zdt_dropbox_default_box_shadow));
18
+ --zd_bs_dropbox_bottom: var(--zd_bs_contrast_outline, 0 3px 30px var(--zdt_dropbox_default_box_shadow));
19
+ --zd_bs_dropbox_arrow: var(--zd_bs_contrast_outline, 1px -1px 2px 0 var(--dropbox_arrow_box_shadow_color));
20
+
21
+ /* ribbon */
22
+ --zd_bs_ribbon_default: var(--zd_bs_contrast_outline, 0 5px 10px var(--zdt_ribbon_default_shadow));
23
+ --zd_bs_ribbon_danger: var(--zd_bs_contrast_outline, 0 5px 10px var(--zdt_ribbon_danger_shadow));
24
+ --zd_bs_ribbon_primary: var(--zd_bs_contrast_outline, 0 5px 10px var(--zdt_ribbon_primary_shadow));
25
+ --zd_bs_ribbon_secondary: var(--zd_bs_contrast_outline, 0 5px 10px var(--zdt_ribbon_secondary_shadow));
26
+ --zd_bs_ribbon_info: var(--zd_bs_contrast_outline, 0 5px 10px var(--zdt_ribbon_info_shadow));
27
+ --zd_bs_ribbon_dark: var(--zd_bs_contrast_outline, 0 5px 10px var(--zdt_ribbon_dark_shadow));
28
+
29
+ /* switch */
30
+ --zd_bs_switch_default: var(--zd_bs_contrast_outline, 0 1px 4px 0 var(--zdt_switch_circle_shadow));
31
+
32
+ /* tabs */
33
+ --zd_bs_tabs_shadow: var(--zd_bs_contrast_outline, 0 -2px 9px var(--zdt_tabs_alpha_box_shadow));
34
+ }
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.bind = bind;
7
7
  exports.bytesToSize = bytesToSize;
8
+ exports.cancelBubblingEffect = cancelBubblingEffect;
8
9
  exports.capitalize = capitalize;
9
10
  exports.checkIsImageFile = checkIsImageFile;
10
11
  exports.debounce = exports.cs = void 0;
@@ -56,6 +57,11 @@ var stopAllEventPropagation = function stopAllEventPropagation(e) {
56
57
  e.stopPropagation && e.stopPropagation();
57
58
  e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
58
59
  };
60
+ exports.stopAllEventPropagation = stopAllEventPropagation;
61
+ function cancelBubblingEffect(e) {
62
+ e && e.stopPropagation && e.stopPropagation();
63
+ e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation && e.nativeEvent.stopImmediatePropagation();
64
+ }
59
65
 
60
66
  // export function getCommentsDetails(
61
67
  // commentIds = [],
@@ -70,7 +76,7 @@ var stopAllEventPropagation = function stopAllEventPropagation(e) {
70
76
  // }) || []
71
77
  // );
72
78
  // }
73
- exports.stopAllEventPropagation = stopAllEventPropagation;
79
+
74
80
  function encodeForHtml(str) {
75
81
  if (/<|>|&|"|'|\\/g.test(str) == true) {
76
82
  str = str.replace(/&/g, '&amp;');
@@ -30,20 +30,33 @@ function mergeStyle(defaultStyle) {
30
30
  // return res;
31
31
  throw new Error("UNKNOWN CLASSNAME DETECTED - Given customStyle's key \"".concat(styleName, "\" is not available in that component style"));
32
32
  }
33
- var val = defaultStyle[styleName];
34
- Object.keys(res).map(function (keyName) {
35
- var styleKey = res[keyName];
36
- if (styleKey.includes(val)) {
37
- res[keyName] = styleKey.replace(val, styleValue);
38
- }
39
- });
40
- } else if (defaultStyle[next] || additionalStyle.includes(next)) {
33
+ if (additionalStyle.includes(styleName)) {
34
+ res[styleName] = styleValue;
35
+ } else {
36
+ var val = defaultStyle[styleName];
37
+ Object.keys(res).map(function (keyName) {
38
+ var styleKey = res[keyName];
39
+ var styleClasses = styleKey.split(' ');
40
+ var ind = styleClasses.indexOf(val);
41
+ if (ind !== -1) {
42
+ styleClasses[ind] = styleValue;
43
+ res[keyName] = styleClasses.join(' ');
44
+ }
45
+ });
46
+ }
47
+ } else if (defaultStyle[next]) {
41
48
  var _val = defaultStyle[next];
42
49
  Object.keys(res).map(function (keyName) {
43
- if (res[keyName].includes(_val)) {
44
- res[keyName] = res[keyName] + ' ' + customStyle[next];
50
+ var styleKey = res[keyName];
51
+ var styleClasses = styleKey.split(' ');
52
+ var ind = styleClasses.indexOf(_val);
53
+ if (ind !== -1) {
54
+ styleClasses[ind] = styleClasses[ind] + ' ' + customStyle[next];
55
+ res[keyName] = styleClasses.join(' ');
45
56
  }
46
57
  });
58
+ } else if (additionalStyle.includes(next)) {
59
+ res[next] = customStyle[next];
47
60
  } else if (!defaultStyle[next] && !additionalStyle.includes(next)) {
48
61
  // res[next] = customStyle[next];
49
62
  "UNKNOWN CLASSNAME DETECTED - Given customStyle's key \"".concat(next, "\" is not available in that component style");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-alpha-264",
3
+ "version": "1.0.0-alpha-266",
4
4
  "main": "es/index.js",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -47,12 +47,12 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@zohodesk/docstool": "1.0.0-alpha-2",
50
- "@zohodesk/variables": "1.0.0-beta.30",
51
- "@zohodesk/icons": "1.0.0-beta.119",
50
+ "@zohodesk/variables": "1.0.0-beta.31",
51
+ "@zohodesk/icons": "1.0.0-beta.125",
52
52
  "@zohodesk/virtualizer": "1.0.3",
53
53
  "velocity-react": "1.4.3",
54
54
  "react-sortable-hoc": "^0.8.3",
55
- "@zohodesk/svg": "1.0.0-beta.54",
55
+ "@zohodesk/svg": "1.0.0-beta.56",
56
56
  "@zohodesk/a11y": "1.3.7"
57
57
  },
58
58
  "dependencies": {
@@ -62,9 +62,9 @@
62
62
  "selectn": "1.1.2"
63
63
  },
64
64
  "peerDependencies": {
65
- "@zohodesk/icons": "1.0.0-beta.119",
66
- "@zohodesk/variables": "1.0.0-beta.30",
67
- "@zohodesk/svg": "1.0.0-beta.54",
65
+ "@zohodesk/icons": "1.0.0-beta.125",
66
+ "@zohodesk/variables": "1.0.0-beta.31",
67
+ "@zohodesk/svg": "1.0.0-beta.56",
68
68
  "@zohodesk/virtualizer": "1.0.3",
69
69
  "velocity-react": "1.4.3",
70
70
  "react-sortable-hoc": "^0.8.3",
@@ -100,4 +100,4 @@
100
100
  "cssUniqueness": "false"
101
101
  }
102
102
  }
103
- }
103
+ }
@@ -1,190 +0,0 @@
1
- import React from 'react';
2
- import Button from '../Button';
3
- import TestUtils from 'react-dom/test-utils';
4
- import renderer from 'react-test-renderer';
5
- describe('Button component', () => {
6
- it('should display text', () => {
7
- let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
8
- text: "primary",
9
- palette: "primary"
10
- }));
11
- expect(TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp').textContent.contains('primary')).toBe(true);
12
- });
13
- it('should be able to click', () => {
14
- let mockfn = jest.fn();
15
- let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
16
- text: "primary",
17
- palette: "primary",
18
- onClick: mockfn
19
- }));
20
- let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
21
- TestUtils.Simulate.click(buttonEle);
22
- expect(mockfn.mock.calls.length).toBe(1);
23
- });
24
- it('should not able to click', () => {
25
- let mockfn = jest.fn();
26
- let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
27
- text: "primary",
28
- palette: "primary",
29
- onClick: mockfn,
30
- disabled: true
31
- }));
32
- let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp_disabled');
33
- TestUtils.Simulate.click(buttonEle);
34
- expect(mockfn.mock.calls.length).toBe(0);
35
- });
36
- it('should not able to click on loading status', () => {
37
- let mockfn = jest.fn();
38
- let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
39
- text: "primary",
40
- palette: "primary",
41
- onClick: mockfn,
42
- status: "loading"
43
- }));
44
- let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
45
- TestUtils.Simulate.click(buttonEle);
46
- expect(mockfn.mock.calls.length).toBe(0);
47
- });
48
- it('should able to click other than loading status', () => {
49
- let mockfn = jest.fn();
50
- let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
51
- text: "primary",
52
- palette: "primary",
53
- onClick: mockfn,
54
- status: "success"
55
- }));
56
- let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
57
- TestUtils.Simulate.click(buttonEle);
58
- expect(mockfn.mock.calls.length).toBe(1);
59
- });
60
- it('should able to click and click arguments should be event object', () => {
61
- let mockfn = jest.fn();
62
- let renderedDOM = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(Button, {
63
- text: "primary",
64
- palette: "primary",
65
- onClick: mockfn,
66
- status: "success"
67
- }));
68
- let buttonEle = TestUtils.findRenderedComponentsWithTestid(renderedDOM, 'buttonComp');
69
- TestUtils.Simulate.click(buttonEle);
70
- expect(mockfn.mock.calls.length).toBe(1);
71
- expect(mockfn.mock.calls[0].length).toBe(1);
72
- });
73
- it('should the palette is plainPrimary', () => {
74
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
75
- text: "primary",
76
- palette: "plainPrimary"
77
- }));
78
- let tree = ele.toJSON();
79
- expect(tree).toMatchSnapshot();
80
- });
81
- it('should the palette is plainSecondary', () => {
82
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
83
- text: "plainSecondary",
84
- palette: "plainSecondary"
85
- }));
86
- let tree = ele.toJSON();
87
- expect(tree).toMatchSnapshot();
88
- });
89
- it('should the palette is primaryFilled', () => {
90
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
91
- text: "primaryFilled",
92
- palette: "primaryFilled"
93
- }));
94
- let tree = ele.toJSON();
95
- expect(tree).toMatchSnapshot();
96
- });
97
- it('should the palette is danger', () => {
98
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
99
- text: "danger",
100
- palette: "danger"
101
- }));
102
- let tree = ele.toJSON();
103
- expect(tree).toMatchSnapshot();
104
- });
105
- it('should the palette is dangerFilled', () => {
106
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
107
- text: "dangerFilled",
108
- palette: "dangerFilled"
109
- }));
110
- let tree = ele.toJSON();
111
- expect(tree).toMatchSnapshot();
112
- });
113
- it('should the palette is secondary', () => {
114
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
115
- text: "secondary",
116
- palette: "secondary"
117
- }));
118
- let tree = ele.toJSON();
119
- expect(tree).toMatchSnapshot();
120
- });
121
- it('should the palette is secondaryFilled', () => {
122
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
123
- text: "secondaryFilled",
124
- palette: "secondaryFilled"
125
- }));
126
- let tree = ele.toJSON();
127
- expect(tree).toMatchSnapshot();
128
- });
129
- it('should is not bold', () => {
130
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
131
- text: "secondaryFilled",
132
- isBold: false
133
- }));
134
- let tree = ele.toJSON();
135
- expect(tree).toMatchSnapshot();
136
- });
137
- it('should is rounded', () => {
138
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
139
- text: "secondaryFilled",
140
- rounded: true
141
- }));
142
- let tree = ele.toJSON();
143
- expect(tree).toMatchSnapshot();
144
- });
145
- it('should the size is small', () => {
146
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
147
- text: "small",
148
- rounded: true,
149
- size: "small"
150
- }));
151
- let tree = ele.toJSON();
152
- expect(tree).toMatchSnapshot();
153
- });
154
- it('should the size is large', () => {
155
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
156
- text: "large",
157
- rounded: true,
158
- size: "large"
159
- }));
160
- let tree = ele.toJSON();
161
- expect(tree).toMatchSnapshot();
162
- });
163
- it('should the size is xlarge', () => {
164
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
165
- text: "xlarge",
166
- rounded: true,
167
- size: "xlarge"
168
- }));
169
- let tree = ele.toJSON();
170
- expect(tree).toMatchSnapshot();
171
- });
172
- it('should the status is loading', () => {
173
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
174
- text: "secondaryFilled",
175
- rounded: true,
176
- status: "loading"
177
- }));
178
- let tree = ele.toJSON();
179
- expect(tree).toMatchSnapshot();
180
- });
181
- it('should the status is success', () => {
182
- let ele = renderer.create( /*#__PURE__*/React.createElement(Button, {
183
- text: "secondaryFilled",
184
- rounded: true,
185
- status: "success"
186
- }));
187
- let tree = ele.toJSON();
188
- expect(tree).toMatchSnapshot();
189
- });
190
- });
@@ -1,191 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Button component should is not bold 1`] = `
4
- <button
5
- className=" primary medium "
6
- data-id="buttonComp"
7
- disabled={false}
8
- onClick={[Function]}
9
- type="button"
10
- >
11
- secondaryFilled
12
- </button>
13
- `;
14
-
15
- exports[`Button component should is rounded 1`] = `
16
- <button
17
- className=" primary rounded medium bold "
18
- data-id="buttonComp"
19
- disabled={false}
20
- onClick={[Function]}
21
- type="button"
22
- >
23
- secondaryFilled
24
- </button>
25
- `;
26
-
27
- exports[`Button component should the palette is danger 1`] = `
28
- <button
29
- className=" danger medium bold "
30
- data-id="buttonComp"
31
- disabled={false}
32
- onClick={[Function]}
33
- type="button"
34
- >
35
- danger
36
- </button>
37
- `;
38
-
39
- exports[`Button component should the palette is dangerFilled 1`] = `
40
- <button
41
- className=" dangerfilled medium bold "
42
- data-id="buttonComp"
43
- disabled={false}
44
- onClick={[Function]}
45
- type="button"
46
- >
47
- dangerFilled
48
- </button>
49
- `;
50
-
51
- exports[`Button component should the palette is plainPrimary 1`] = `
52
- <button
53
- className=" plainprimary medium bold "
54
- data-id="buttonComp"
55
- disabled={false}
56
- onClick={[Function]}
57
- type="button"
58
- >
59
- primary
60
- </button>
61
- `;
62
-
63
- exports[`Button component should the palette is plainSecondary 1`] = `
64
- <button
65
- className=" plainsecondary medium bold "
66
- data-id="buttonComp"
67
- disabled={false}
68
- onClick={[Function]}
69
- type="button"
70
- >
71
- plainSecondary
72
- </button>
73
- `;
74
-
75
- exports[`Button component should the palette is primaryFilled 1`] = `
76
- <button
77
- className=" primaryfilled medium bold "
78
- data-id="buttonComp"
79
- disabled={false}
80
- onClick={[Function]}
81
- type="button"
82
- >
83
- primaryFilled
84
- </button>
85
- `;
86
-
87
- exports[`Button component should the palette is secondary 1`] = `
88
- <button
89
- className=" secondary medium bold "
90
- data-id="buttonComp"
91
- disabled={false}
92
- onClick={[Function]}
93
- type="button"
94
- >
95
- secondary
96
- </button>
97
- `;
98
-
99
- exports[`Button component should the palette is secondaryFilled 1`] = `
100
- <button
101
- className=" secondaryfilled medium bold "
102
- data-id="buttonComp"
103
- disabled={false}
104
- onClick={[Function]}
105
- type="button"
106
- >
107
- secondaryFilled
108
- </button>
109
- `;
110
-
111
- exports[`Button component should the size is large 1`] = `
112
- <button
113
- className=" primary rounded large bold "
114
- data-id="buttonComp"
115
- disabled={false}
116
- onClick={[Function]}
117
- type="button"
118
- >
119
- large
120
- </button>
121
- `;
122
-
123
- exports[`Button component should the size is small 1`] = `
124
- <button
125
- className=" primary rounded small bold "
126
- data-id="buttonComp"
127
- disabled={false}
128
- onClick={[Function]}
129
- type="button"
130
- >
131
- small
132
- </button>
133
- `;
134
-
135
- exports[`Button component should the size is xlarge 1`] = `
136
- <button
137
- className=" primary rounded xlarge bold "
138
- data-id="buttonComp"
139
- disabled={false}
140
- onClick={[Function]}
141
- type="button"
142
- >
143
- xlarge
144
- </button>
145
- `;
146
-
147
- exports[`Button component should the status is loading 1`] = `
148
- <button
149
- className=" primary rounded medium bold "
150
- data-id="buttonComp"
151
- disabled={true}
152
- onClick={[Function]}
153
- type="button"
154
- >
155
- secondaryFilled
156
- <div
157
- className="overlay"
158
- >
159
- <div
160
- className="loading"
161
- >
162
- <div
163
- className="element"
164
- />
165
- </div>
166
- </div>
167
- </button>
168
- `;
169
-
170
- exports[`Button component should the status is success 1`] = `
171
- <button
172
- className=" primary rounded medium bold "
173
- data-id="buttonComp"
174
- disabled={false}
175
- onClick={[Function]}
176
- type="button"
177
- >
178
- secondaryFilled
179
- <div
180
- className="overlay"
181
- >
182
- <div
183
- className="success"
184
- >
185
- <div
186
- className="element"
187
- />
188
- </div>
189
- </div>
190
- </button>
191
- `;