@reltio/components 1.4.2070 → 1.4.2071

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 (159) hide show
  1. package/FacetViewHeader/FacetViewHeader.js +1 -1
  2. package/ImageAttributesLine/imageAttributeValues.test-data.js +8 -0
  3. package/ImageAttributesLine/index.d.ts +1 -1
  4. package/ImageAttributesLine/index.js +1 -1
  5. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +1 -1
  6. package/MergeButton/MergeButton.spec.js +55 -124
  7. package/MetadataTypesSelector/MetadataTypesSelector.js +1 -1
  8. package/MetadataTypesSelector/MetadataTypesSelector.test.js +193 -190
  9. package/MoreAttributesButton/MoreAttributesButton.test.js +173 -166
  10. package/MultiValueSelector/MultiValueSelector.test.js +78 -38
  11. package/MultipliableSelect/MultipliableSelect.test.js +111 -47
  12. package/NestedAttribute/NestedAttribute.test.js +121 -42
  13. package/NestedAttributeEditor/NestedAttributeEditor.test.js +95 -41
  14. package/NotMatchButton/NotMatchButton.spec.js +51 -100
  15. package/PieChart/PieChart.test.js +130 -114
  16. package/PinButton/PinButton.spec.js +89 -22
  17. package/PivotingTooltip/PivotingTooltip.test.js +338 -174
  18. package/PotentialMatchReviewCard/PotentialMatchReviewCard.spec.js +94 -29
  19. package/ProfileBand/ProfileBand.spec.js +60 -53
  20. package/ProfileCard/ProfileCard.test.js +109 -27
  21. package/ProfilesList/ProfilesList.d.ts +1 -3
  22. package/ProfilesList/ProfilesList.js +1 -1
  23. package/ProfilesList/ProfilesList.spec.js +226 -211
  24. package/QueryBuilderRow/QueryBuilderRow.spec.js +83 -90
  25. package/QueryBuilderRowsGroup/QueryBuilderRowsGroup.spec.js +195 -86
  26. package/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +73 -15
  27. package/ReactSelectMenuWithPopper/ReactSelectMenuWithPopper.test.js +71 -117
  28. package/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +128 -61
  29. package/ReadOnlyAttributesFactory/components/ReadOnlyAttribute/ReadOnlyAttribute.test.js +179 -44
  30. package/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +254 -211
  31. package/ReadOnlyAttributesList/attributes.test-data.js +4 -4
  32. package/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +75 -18
  33. package/ReadOnlyAttributesView/ReadOnlyAttributesView.test.js +187 -312
  34. package/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +210 -219
  35. package/ReadOnlyImageAttributesLine/ReadOnlyImageAttributesLine.test.js +89 -89
  36. package/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +556 -602
  37. package/ReferenceAttributeEditor/metadata.test-data.d.ts +13 -13
  38. package/ReferenceAttributeEditor/metadata.test-data.js +2 -2
  39. package/ReferenceAttributeEditor/styles.d.ts +1 -1
  40. package/RelationEditor/RelationEditor.test.js +1448 -1392
  41. package/RelationTypeSelector/RelationTypeSelector.test.js +99 -17
  42. package/RelationTypesSelector/RelationTypesSelector.test.js +73 -22
  43. package/ReltioMap/ReltioMap.spec.js +51 -25
  44. package/Roles/Roles.test.js +54 -10
  45. package/ScreenProfileBand/ScreenProfileBand.test.js +142 -72
  46. package/cjs/FacetViewHeader/FacetViewHeader.js +1 -1
  47. package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +8 -0
  48. package/cjs/ImageAttributesLine/index.d.ts +1 -1
  49. package/cjs/ImageAttributesLine/index.js +2 -1
  50. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +1 -1
  51. package/cjs/MergeButton/MergeButton.spec.js +55 -124
  52. package/cjs/MetadataTypesSelector/MetadataTypesSelector.js +1 -1
  53. package/cjs/MetadataTypesSelector/MetadataTypesSelector.test.js +193 -190
  54. package/cjs/MoreAttributesButton/MoreAttributesButton.test.js +172 -165
  55. package/cjs/MultiValueSelector/MultiValueSelector.test.js +78 -38
  56. package/cjs/MultipliableSelect/MultipliableSelect.test.js +111 -47
  57. package/cjs/NestedAttribute/NestedAttribute.test.js +121 -42
  58. package/cjs/NestedAttributeEditor/NestedAttributeEditor.test.js +94 -40
  59. package/cjs/NotMatchButton/NotMatchButton.spec.js +51 -100
  60. package/cjs/PieChart/PieChart.test.js +130 -114
  61. package/cjs/PinButton/PinButton.spec.js +89 -22
  62. package/cjs/PivotingTooltip/PivotingTooltip.test.js +338 -174
  63. package/cjs/PotentialMatchReviewCard/PotentialMatchReviewCard.spec.js +94 -29
  64. package/cjs/ProfileBand/ProfileBand.spec.js +60 -53
  65. package/cjs/ProfileCard/ProfileCard.test.js +109 -27
  66. package/cjs/ProfilesList/ProfilesList.d.ts +1 -3
  67. package/cjs/ProfilesList/ProfilesList.js +1 -1
  68. package/cjs/ProfilesList/ProfilesList.spec.js +226 -211
  69. package/cjs/QueryBuilderRow/QueryBuilderRow.spec.js +83 -90
  70. package/cjs/QueryBuilderRowsGroup/QueryBuilderRowsGroup.spec.js +195 -86
  71. package/cjs/ReactSelectLoadMoreButton/ReactSelectLoadMoreButton.test.js +73 -15
  72. package/cjs/ReactSelectMenuWithPopper/ReactSelectMenuWithPopper.test.js +71 -117
  73. package/cjs/ReadOnlyAttributeValuesBlock/ReadOnlyAttributeValuesBlock.test.js +128 -61
  74. package/cjs/ReadOnlyAttributesFactory/components/ReadOnlyAttribute/ReadOnlyAttribute.test.js +179 -44
  75. package/cjs/ReadOnlyAttributesList/ReadOnlyAttributesList.test.js +254 -211
  76. package/cjs/ReadOnlyAttributesList/attributes.test-data.js +4 -4
  77. package/cjs/ReadOnlyAttributesPager/ReadOnlyAttributesPager.test.js +75 -18
  78. package/cjs/ReadOnlyAttributesView/ReadOnlyAttributesView.test.js +185 -310
  79. package/cjs/ReadOnlyComplexAttribute/ReadOnlyComplexAttribute.test.js +209 -218
  80. package/cjs/ReadOnlyImageAttributesLine/ReadOnlyImageAttributesLine.test.js +89 -89
  81. package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.test.js +555 -601
  82. package/cjs/ReferenceAttributeEditor/metadata.test-data.d.ts +13 -13
  83. package/cjs/ReferenceAttributeEditor/metadata.test-data.js +2 -2
  84. package/cjs/ReferenceAttributeEditor/styles.d.ts +1 -1
  85. package/cjs/RelationEditor/RelationEditor.test.js +1446 -1390
  86. package/cjs/RelationTypeSelector/RelationTypeSelector.test.js +99 -17
  87. package/cjs/RelationTypesSelector/RelationTypesSelector.test.js +73 -22
  88. package/cjs/ReltioMap/ReltioMap.spec.js +51 -25
  89. package/cjs/Roles/Roles.test.js +54 -10
  90. package/cjs/ScreenProfileBand/ScreenProfileBand.test.js +141 -71
  91. package/package.json +1 -1
  92. package/MetadataTypesSelector/components/ListLabel/ListLabel.test.d.ts +0 -1
  93. package/MetadataTypesSelector/components/ListLabel/ListLabel.test.js +0 -24
  94. package/PivotingTooltip/IntegrationPivotingTooltip.test.d.ts +0 -1
  95. package/PivotingTooltip/IntegrationPivotingTooltip.test.js +0 -356
  96. package/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.d.ts +0 -1
  97. package/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +0 -201
  98. package/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.d.ts +0 -1
  99. package/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.js +0 -43
  100. package/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.d.ts +0 -1
  101. package/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.js +0 -31
  102. package/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.d.ts +0 -1
  103. package/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.js +0 -31
  104. package/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
  105. package/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -45
  106. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.d.ts +0 -1
  107. package/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.js +0 -114
  108. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.d.ts +0 -1
  109. package/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.js +0 -107
  110. package/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
  111. package/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -72
  112. package/RelationEditor/IntegrationRelationEditor.test.d.ts +0 -1
  113. package/RelationEditor/IntegrationRelationEditor.test.js +0 -337
  114. package/ReltioMap/components/MapControlContainer/MapControlContainer.d.ts +0 -10
  115. package/ReltioMap/components/MapControlContainer/MapControlContainer.js +0 -24
  116. package/ReltioMap/components/MapControlContainer/MapControlContainer.spec.d.ts +0 -1
  117. package/ReltioMap/components/MapControlContainer/MapControlContainer.spec.js +0 -33
  118. package/ReltioMap/components/MapControlContainer/index.d.ts +0 -1
  119. package/ReltioMap/components/MapControlContainer/index.js +0 -1
  120. package/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.d.ts +0 -1
  121. package/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.js +0 -36
  122. package/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.d.ts +0 -1
  123. package/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.js +0 -60
  124. package/Roles/components/Role/Role.test.d.ts +0 -1
  125. package/Roles/components/Role/Role.test.js +0 -55
  126. package/cjs/MetadataTypesSelector/components/ListLabel/ListLabel.test.d.ts +0 -1
  127. package/cjs/MetadataTypesSelector/components/ListLabel/ListLabel.test.js +0 -52
  128. package/cjs/PivotingTooltip/IntegrationPivotingTooltip.test.d.ts +0 -1
  129. package/cjs/PivotingTooltip/IntegrationPivotingTooltip.test.js +0 -361
  130. package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.d.ts +0 -1
  131. package/cjs/PivotingTooltip/components/PivotingTooltipContent/PivotingTooltipContent.test.js +0 -206
  132. package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.d.ts +0 -1
  133. package/cjs/ProfileCard/components/ProfileCardContent/ProfileCardContent.test.js +0 -48
  134. package/cjs/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.d.ts +0 -1
  135. package/cjs/QueryBuilderRow/components/ReadOnlyFilter/ReadOnlyFilter.spec.js +0 -36
  136. package/cjs/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.d.ts +0 -1
  137. package/cjs/QueryBuilderRow/components/ReadOnlyLogicOperator/ReadOnlyLogicOperator.spec.js +0 -36
  138. package/cjs/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.d.ts +0 -1
  139. package/cjs/ReadOnlyAttributesPager/components/ImageLineRenderer/ImageLineRenderer.test.js +0 -50
  140. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.d.ts +0 -1
  141. package/cjs/ReadOnlyAttributesPager/components/MultiLineRenderer/MultiLineRenderer.test.js +0 -119
  142. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.d.ts +0 -1
  143. package/cjs/ReadOnlyAttributesPager/components/OneLineRenderer/OneLineRenderer.test.js +0 -112
  144. package/cjs/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.d.ts +0 -1
  145. package/cjs/ReadOnlyAttributesPager/components/SpecialRenderer/SpecialRenderer.test.js +0 -77
  146. package/cjs/RelationEditor/IntegrationRelationEditor.test.d.ts +0 -1
  147. package/cjs/RelationEditor/IntegrationRelationEditor.test.js +0 -342
  148. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.d.ts +0 -10
  149. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.js +0 -28
  150. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.spec.d.ts +0 -1
  151. package/cjs/ReltioMap/components/MapControlContainer/MapControlContainer.spec.js +0 -38
  152. package/cjs/ReltioMap/components/MapControlContainer/index.d.ts +0 -1
  153. package/cjs/ReltioMap/components/MapControlContainer/index.js +0 -5
  154. package/cjs/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.d.ts +0 -1
  155. package/cjs/ReltioMap/components/TopCenterMapControls/TopCenterMapControls.spec.js +0 -41
  156. package/cjs/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.d.ts +0 -1
  157. package/cjs/ReltioMap/components/TopRightMapControls/TopRightMapControls.spec.js +0 -65
  158. package/cjs/Roles/components/Role/Role.test.d.ts +0 -1
  159. package/cjs/Roles/components/Role/Role.test.js +0 -60
@@ -1,128 +1,82 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
17
  var react_1 = __importDefault(require("react"));
7
- var enzyme_1 = require("enzyme");
8
- var Popper_1 = __importDefault(require("@mui/material/Popper"));
9
- var Paper_1 = __importDefault(require("@mui/material/Paper"));
18
+ var react_2 = require("@testing-library/react");
10
19
  var PopupBoundariesContext_1 = require("../contexts/PopupBoundariesContext");
11
20
  var ReactSelectMenuWithPopper_1 = require("./ReactSelectMenuWithPopper");
12
- describe('ReactSelectMenuWithPopper tests', function () {
13
- var getPopper = function (component) { return component.find(Popper_1.default); };
14
- it('should provide preventOverflow modifier for Popper only when PopupBoundariesContext is defined', function () {
15
- var testInputRef = { current: {} };
16
- var testInnerRef = { current: {} };
17
- var component = (0, enzyme_1.mount)(react_1.default.createElement(ReactSelectMenuWithPopper_1.ReactSelectMenuWithPopper, { selectProps: {
18
- inputRef: testInputRef,
19
- inputValue: '',
20
- menuIsOpen: true
21
- }, innerRef: testInnerRef, innerProps: {} },
22
- react_1.default.createElement("div", null)));
23
- expect(getPopper(component).prop('modifiers')).toEqual([
24
- {
25
- enabled: true,
26
- name: 'preventOverflow',
27
- options: {
28
- altAxis: true,
29
- altBoundary: true,
30
- tether: false,
31
- boundary: document.body,
32
- padding: 5
33
- }
34
- }
35
- ]);
36
- var textContext = { element: react_1.default.createElement("div", null), priority: ['top'] };
37
- var componentWithContext = (0, enzyme_1.mount)(react_1.default.createElement(PopupBoundariesContext_1.PopupBoundariesContext.Provider, { value: textContext },
38
- react_1.default.createElement(ReactSelectMenuWithPopper_1.ReactSelectMenuWithPopper, { selectProps: {
39
- inputRef: testInputRef,
40
- inputValue: '',
41
- menuIsOpen: true
42
- }, innerRef: testInnerRef, innerProps: {} },
43
- react_1.default.createElement("div", null))));
44
- expect(getPopper(componentWithContext).prop('modifiers')).toEqual([
45
- {
46
- enabled: true,
47
- name: 'preventOverflow',
48
- options: {
49
- altAxis: true,
50
- altBoundary: true,
51
- tether: false,
52
- boundary: textContext.element,
53
- padding: 5
54
- }
55
- }
56
- ]);
21
+ var setUp = function (_a) {
22
+ var props = _a.props, _b = _a.popupBoundariesContextValue, popupBoundariesContextValue = _b === void 0 ? null : _b;
23
+ var Providers = function (_a) {
24
+ var children = _a.children;
25
+ return (react_1.default.createElement(PopupBoundariesContext_1.PopupBoundariesContext.Provider, { value: popupBoundariesContextValue }, children));
26
+ };
27
+ return (0, react_2.render)(react_1.default.createElement(ReactSelectMenuWithPopper_1.ReactSelectMenuWithPopper, __assign({}, props)), { wrapper: Providers });
28
+ };
29
+ describe('React select menu with popper tests', function () {
30
+ var originalWindowInnerWidth;
31
+ beforeAll(function () {
32
+ originalWindowInnerWidth = window.innerWidth;
33
+ });
34
+ afterEach(function () {
35
+ window.innerWidth = originalWindowInnerWidth;
36
+ });
37
+ it('should set paper minWidth as input width and maxWidth as boundaries element width', function () {
38
+ var inputEl = document.createElement('input');
39
+ var boundariesEl = document.createElement('div');
40
+ Object.defineProperty(inputEl, 'clientWidth', { value: 200 });
41
+ Object.defineProperty(boundariesEl, 'clientWidth', { value: 400 });
42
+ Object.defineProperty(window, 'innerWidth', { value: 500 });
43
+ var props = {
44
+ innerRef: react_1.default.createRef(),
45
+ selectProps: { inputRef: { current: inputEl }, inputValue: '', menuIsOpen: true },
46
+ innerProps: {},
47
+ children: ['Children']
48
+ };
49
+ var popupBoundariesContextValue = { element: boundariesEl };
50
+ setUp({ props: props, popupBoundariesContextValue: popupBoundariesContextValue });
51
+ expect(react_2.screen.getByText('Children')).toHaveStyle({ minWidth: '200px', maxWidth: '400px' });
52
+ });
53
+ it('should set paper minWidth as window.innerWidth if there is no boundaries element', function () {
54
+ var inputEl = document.createElement('input');
55
+ Object.defineProperty(inputEl, 'clientWidth', { value: 200 });
56
+ Object.defineProperty(window, 'innerWidth', { value: 500 });
57
+ var props = {
58
+ innerRef: react_1.default.createRef(),
59
+ selectProps: { inputRef: { current: inputEl }, inputValue: '', menuIsOpen: true },
60
+ innerProps: {},
61
+ children: ['Children']
62
+ };
63
+ setUp({ props: props });
64
+ expect(react_2.screen.getByText('Children')).toHaveStyle({ minWidth: '200px', maxWidth: '500px' });
57
65
  });
58
- describe('minWidth/maxWidth behavior', function () {
59
- var originalWindowInnerWidth;
60
- beforeAll(function () {
61
- originalWindowInnerWidth = window.innerWidth;
62
- });
63
- afterEach(function () {
64
- window.innerWidth = originalWindowInnerWidth;
65
- });
66
- it('should set Paper props style.minWidth as input width and style.maxWidth as boundaries element width', function () {
67
- var inputWidth = 200;
68
- var boundariesElementWidth = 400;
69
- var windowInnerWidth = 500;
70
- window.innerWidth = windowInnerWidth;
71
- var testInputRef = { current: { clientWidth: inputWidth } };
72
- var boundariesElement = {
73
- clientWidth: boundariesElementWidth
74
- };
75
- var component = (0, enzyme_1.mount)(react_1.default.createElement(PopupBoundariesContext_1.PopupBoundariesContext.Provider, { value: { element: boundariesElement } },
76
- react_1.default.createElement(ReactSelectMenuWithPopper_1.ReactSelectMenuWithPopper, { selectProps: {
77
- inputRef: testInputRef,
78
- inputValue: '',
79
- menuIsOpen: true
80
- }, innerRef: { current: {} }, innerProps: {} },
81
- react_1.default.createElement("div", null))));
82
- var paper = getPopper(component).find(Paper_1.default);
83
- expect(paper.prop('style')).toEqual({
84
- minWidth: inputWidth,
85
- maxWidth: boundariesElementWidth
86
- });
87
- });
88
- it('should set Paper props style.maxWidth as window.innerWidth if there is no boundaries element', function () {
89
- var inputWidth = 200;
90
- var windowInnerWidth = 500;
91
- window.innerWidth = windowInnerWidth;
92
- var testInputRef = { current: { clientWidth: inputWidth } };
93
- var component = (0, enzyme_1.mount)(react_1.default.createElement(ReactSelectMenuWithPopper_1.ReactSelectMenuWithPopper, { selectProps: {
94
- inputRef: testInputRef,
95
- inputValue: '',
96
- menuIsOpen: true
97
- }, innerRef: { current: {} }, innerProps: {} },
98
- react_1.default.createElement("div", null)));
99
- var paper = getPopper(component).find(Paper_1.default);
100
- expect(paper.prop('style')).toEqual({
101
- minWidth: inputWidth,
102
- maxWidth: windowInnerWidth
103
- });
104
- });
105
- it('should set Paper props style.minWidth as boundaries element width if it is smaller than input width', function () {
106
- var inputWidth = 450;
107
- var boundariesElementWidth = 400;
108
- var windowInnerWidth = 500;
109
- window.innerWidth = windowInnerWidth;
110
- var testInputRef = { current: { clientWidth: inputWidth } };
111
- var boundariesElement = {
112
- clientWidth: boundariesElementWidth
113
- };
114
- var component = (0, enzyme_1.mount)(react_1.default.createElement(PopupBoundariesContext_1.PopupBoundariesContext.Provider, { value: { element: boundariesElement } },
115
- react_1.default.createElement(ReactSelectMenuWithPopper_1.ReactSelectMenuWithPopper, { selectProps: {
116
- inputRef: testInputRef,
117
- inputValue: '',
118
- menuIsOpen: true
119
- }, innerRef: { current: {} }, innerProps: {} },
120
- react_1.default.createElement("div", null))));
121
- var paper = getPopper(component).find(Paper_1.default);
122
- expect(paper.prop('style')).toEqual({
123
- minWidth: boundariesElementWidth,
124
- maxWidth: boundariesElementWidth
125
- });
126
- });
66
+ it('should set paper minWidth as boundaries element width if it is smaller than input width', function () {
67
+ var inputEl = document.createElement('input');
68
+ var boundariesEl = document.createElement('div');
69
+ Object.defineProperty(inputEl, 'clientWidth', { value: 450 });
70
+ Object.defineProperty(boundariesEl, 'clientWidth', { value: 400 });
71
+ Object.defineProperty(window, 'innerWidth', { value: 500 });
72
+ var props = {
73
+ innerRef: react_1.default.createRef(),
74
+ selectProps: { inputRef: { current: inputEl }, inputValue: '', menuIsOpen: true },
75
+ innerProps: {},
76
+ children: ['Children']
77
+ };
78
+ var popupBoundariesContextValue = { element: boundariesEl };
79
+ setUp({ props: props, popupBoundariesContextValue: popupBoundariesContextValue });
80
+ expect(react_2.screen.getByText('Children')).toHaveStyle({ minWidth: '400px', maxWidth: '400px' });
127
81
  });
128
82
  });
@@ -1,76 +1,143 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
6
  var react_1 = __importDefault(require("react"));
18
- var enzyme_1 = require("enzyme");
19
- var ReadOnlyAttributesFactory_1 = require("../ReadOnlyAttributesFactory");
20
- var ReadOnlyImageAttributesLine_1 = require("../ReadOnlyImageAttributesLine");
7
+ var jsdom_testing_mocks_1 = require("jsdom-testing-mocks");
8
+ var react_2 = require("@testing-library/react");
21
9
  var ReadOnlyAttributeValuesBlock_1 = __importDefault(require("./ReadOnlyAttributeValuesBlock"));
22
- describe('ReadOnlyAttributeValuesBlock test', function () {
23
- var values = [
24
- {
25
- uri: 'entities/1/attributes/CountryCode/1',
26
- type: 'configuration/entityTypes/HCP/attributes/CountryCode',
27
- value: 'Italy',
28
- lookupCode: 'IT',
29
- ov: true
30
- }
31
- ];
32
- var attributeType = {
33
- uri: 'configuration/entityTypes/HCP',
34
- label: 'HCP',
35
- name: 'HCP',
36
- type: 'String',
37
- attributes: [
10
+ describe('Read only attribute values block tests', function () {
11
+ var resizeObserver = (0, jsdom_testing_mocks_1.mockResizeObserver)();
12
+ it('should render read only attribute correctly', function () {
13
+ var values = [
38
14
  {
39
- label: 'Country Code',
40
- name: 'CountryCode',
41
- type: 'String',
42
- uri: 'configuration/entityTypes/HCP/attributes/CountryCode'
15
+ uri: 'entities/1/attributes/CountryCode/1',
16
+ type: 'configuration/entityTypes/HCP/attributes/CountryCode',
17
+ value: 'Italy',
18
+ lookupCode: 'IT',
19
+ ov: true
43
20
  }
44
- ]
45
- };
46
- it('should render ReadOnlyAttribute', function () {
47
- var props = { attributeType: attributeType, values: values };
48
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyAttributeValuesBlock_1.default, __assign({}, props)));
49
- var attributes = component.find(ReadOnlyAttributesFactory_1.ReadOnlyAttribute);
50
- expect(attributes).toHaveLength(1);
21
+ ];
22
+ var attributeType = {
23
+ uri: 'configuration/entityTypes/HCP',
24
+ label: 'HCP',
25
+ name: 'HCP',
26
+ type: 'String',
27
+ attributes: [
28
+ {
29
+ label: 'Country Code',
30
+ name: 'CountryCode',
31
+ type: 'String',
32
+ uri: 'configuration/entityTypes/HCP/attributes/CountryCode'
33
+ }
34
+ ]
35
+ };
36
+ (0, react_2.render)(react_1.default.createElement(ReadOnlyAttributeValuesBlock_1.default, { attributeType: attributeType, values: values }));
37
+ react_2.screen.getByText('Italy (IT)');
51
38
  });
52
- it('should render ReadOnlyImageAttributesLine', function () {
53
- var props = {
54
- attributeType: __assign(__assign({}, attributeType), { type: 'Image' }),
55
- values: values
39
+ it('should render read only image attributes line', function () {
40
+ var attributeType = {
41
+ name: 'ImageGallery',
42
+ type: 'Image',
43
+ uri: 'configuration/entityTypes/Series/attributes/ImageGallery',
44
+ attributes: [
45
+ {
46
+ name: 'Url',
47
+ type: 'String',
48
+ uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/Url'
49
+ },
50
+ {
51
+ name: 'UrlThumbnail',
52
+ type: 'String',
53
+ uri: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/UrlThumbnail'
54
+ }
55
+ ]
56
56
  };
57
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyAttributeValuesBlock_1.default, __assign({}, props)));
58
- var attributes = component.find(ReadOnlyImageAttributesLine_1.ReadOnlyImageAttributesLine);
59
- expect(attributes).toHaveLength(1);
57
+ var values = [
58
+ {
59
+ value: {
60
+ Url: [
61
+ {
62
+ type: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/Url',
63
+ ov: true,
64
+ value: '/test.jpg',
65
+ uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv/Url/39V5GWWMh'
66
+ }
67
+ ],
68
+ UrlThumbnail: [
69
+ {
70
+ type: 'configuration/entityTypes/Series/attributes/ImageGallery/attributes/UrlThumbnail',
71
+ ov: true,
72
+ value: '/test.jpg',
73
+ uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv/UrlThumbnail/39V5GWWMh'
74
+ }
75
+ ]
76
+ },
77
+ ov: true,
78
+ uri: 'entities/1Rd2I9Mt/attributes/ImageGallery/39V5GWJZv'
79
+ }
80
+ ];
81
+ var container = (0, react_2.render)(react_1.default.createElement(ReadOnlyAttributeValuesBlock_1.default, { attributeType: attributeType, values: values })).container;
82
+ resizeObserver.mockElementSize(container.children[0], { contentBoxSize: { inlineSize: 600 } });
83
+ (0, react_2.act)(function () {
84
+ resizeObserver.resize();
85
+ });
86
+ expect(react_2.screen.getByRole('img')).toHaveAttribute('src', '/test.jpg');
60
87
  });
61
- it('should forward "expanded", "LabelRenderer" and "RightContent" props to ReadOnlyAttribute', function () {
62
- var props = {
63
- attributeType: __assign(__assign({}, attributeType), { type: 'Nested' }),
64
- values: values,
65
- expanded: true,
66
- LabelRenderer: function () { return react_1.default.createElement("span", null); },
67
- RightContent: function () { return react_1.default.createElement("div", null); }
88
+ it('should render nested read only attribute correctly', function () {
89
+ var attributeType = {
90
+ type: 'Nested',
91
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest',
92
+ name: 'NestedTest',
93
+ label: 'Nested Test',
94
+ attributes: [
95
+ {
96
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest/attributes/FirstName',
97
+ name: 'FirstName',
98
+ label: 'First Name',
99
+ type: 'String'
100
+ },
101
+ {
102
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest/attributes/LastName',
103
+ name: 'LastName',
104
+ label: 'Last Name',
105
+ type: 'String'
106
+ }
107
+ ]
68
108
  };
69
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyAttributeValuesBlock_1.default, __assign({}, props)));
70
- var attributes = component.find(ReadOnlyAttributesFactory_1.ReadOnlyAttribute);
71
- expect(attributes).toHaveLength(1);
72
- expect(attributes.prop('expanded')).toBe(true);
73
- expect(attributes.prop('LabelRenderer')).toBe(props.LabelRenderer);
74
- expect(attributes.prop('RightContent')).toBe(props.RightContent);
109
+ var values = [
110
+ {
111
+ label: 'Nested test label 1',
112
+ value: {
113
+ FirstName: [
114
+ {
115
+ value: 'Viktor',
116
+ uri: 'entities/eNt1/attributes/NestedTest/gd42423/FirstName/8fBsP38A'
117
+ }
118
+ ]
119
+ },
120
+ uri: 'entities/eNt1/attributes/NestedTest/gd42423'
121
+ },
122
+ {
123
+ label: 'Nested test label 2',
124
+ value: {
125
+ LastName: [
126
+ {
127
+ value: 'Ivanov',
128
+ uri: 'entities/eNt1/attributes/NestedTest/ksApL29/LastName/o7BnD6mJ'
129
+ }
130
+ ]
131
+ },
132
+ uri: 'entities/eNt1/attributes/NestedTest/ksApL29'
133
+ }
134
+ ];
135
+ (0, react_2.render)(react_1.default.createElement(ReadOnlyAttributeValuesBlock_1.default, { expanded: true, attributeType: attributeType, values: values }));
136
+ react_2.screen.getByText('Nested test label 1');
137
+ react_2.screen.getByText('First Name');
138
+ react_2.screen.getByText('Viktor');
139
+ react_2.screen.getByText('Nested test label 2');
140
+ react_2.screen.getByText('Last Name');
141
+ react_2.screen.getByText('Ivanov');
75
142
  });
76
143
  });
@@ -10,60 +10,195 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
13
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
51
  };
16
52
  Object.defineProperty(exports, "__esModule", { value: true });
17
53
  var react_1 = __importDefault(require("react"));
18
- var enzyme_1 = require("enzyme");
19
- var SimpleAttribute_1 = require("../../../SimpleAttribute");
20
- var NestedAttribute_1 = require("../../../NestedAttribute");
21
- var ReferenceAttribute_1 = require("../../../ReferenceAttribute");
54
+ var react_2 = require("@testing-library/react");
55
+ var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
22
56
  var ReadOnlyAttribute_1 = require("./ReadOnlyAttribute");
23
- describe('ReadOnlyAttribute', function () {
24
- it('should render Simple attribute', function () {
25
- var props = {
26
- attributeType: {
27
- type: 'String'
28
- },
29
- attributeValue: {
30
- uri: '123'
31
- }
57
+ var setUp = function (_a) {
58
+ var props = _a.props, _b = _a.mdmValues, mdmValues = _b === void 0 ? {} : _b;
59
+ var Providers = function (_a) {
60
+ var children = _a.children;
61
+ return react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmValues }, children);
62
+ };
63
+ return (0, react_2.render)(react_1.default.createElement(ReadOnlyAttribute_1.ReadOnlyAttribute, __assign({}, props)), { wrapper: Providers });
64
+ };
65
+ describe('Read only attribute tests', function () {
66
+ it('should render simple attribute correctly', function () {
67
+ var attributeType = {
68
+ type: 'String',
69
+ uri: 'configuration/entityTypes/HCP/attributes/FirstName',
70
+ name: 'FirstName',
71
+ label: 'First Name'
32
72
  };
33
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyAttribute_1.ReadOnlyAttribute, __assign({}, props)));
34
- expect(component.find(SimpleAttribute_1.SimpleAttribute).length).toBe(1);
35
- expect(component.find(SimpleAttribute_1.SimpleAttribute).props()).toEqual(props);
36
- expect(component.find(NestedAttribute_1.NestedAttribute).length).toBe(0);
37
- expect(component.find(ReferenceAttribute_1.ReferenceAttribute).length).toBe(0);
38
- });
39
- it('should render Nested attribute', function () {
40
- var props = {
41
- attributeType: {
42
- type: 'Nested'
43
- },
44
- attributeValue: {
45
- uri: '123'
46
- }
73
+ var attributeValue = {
74
+ value: 'some string',
75
+ uri: 'entities/eNt1/attributes/FirstName/gd42423'
47
76
  };
48
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyAttribute_1.ReadOnlyAttribute, __assign({}, props)));
49
- expect(component.find(SimpleAttribute_1.SimpleAttribute).length).toBe(0);
50
- expect(component.find(ReferenceAttribute_1.ReferenceAttribute).length).toBe(0);
51
- expect(component.find(NestedAttribute_1.NestedAttribute).length).toBe(1);
52
- expect(component.find(NestedAttribute_1.NestedAttribute).props()).toEqual(props);
77
+ var props = { attributeValue: attributeValue, attributeType: attributeType };
78
+ setUp({ props: props });
79
+ react_2.screen.getByText('some string');
53
80
  });
54
- it('should render Reference attribute', function () {
55
- var props = {
56
- attributeType: {
57
- type: 'Reference'
81
+ it('should render nested attribute correctly', function () {
82
+ var attributeType = {
83
+ type: 'Nested',
84
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest',
85
+ name: 'NestedTest',
86
+ label: 'Nested Test',
87
+ attributes: [
88
+ {
89
+ uri: 'configuration/entityTypes/HCP/attributes/NestedTest/attributes/FirstName',
90
+ name: 'FirstName',
91
+ label: 'First Name',
92
+ type: 'String'
93
+ }
94
+ ]
95
+ };
96
+ var attributeValue = {
97
+ label: 'Nested test label',
98
+ value: {
99
+ FirstName: [
100
+ {
101
+ value: 'some string',
102
+ uri: 'entities/eNt1/attributes/NestedTest/gd42423/FirstName/8fBsP38A'
103
+ }
104
+ ]
58
105
  },
59
- attributeValue: {
60
- uri: '123'
61
- }
106
+ uri: 'entities/eNt1/attributes/NestedTest/gd42423'
62
107
  };
63
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ReadOnlyAttribute_1.ReadOnlyAttribute, __assign({}, props)));
64
- expect(component.find(SimpleAttribute_1.SimpleAttribute).length).toBe(0);
65
- expect(component.find(NestedAttribute_1.NestedAttribute).length).toBe(0);
66
- expect(component.find(ReferenceAttribute_1.ReferenceAttribute).length).toBe(1);
67
- expect(component.find(ReferenceAttribute_1.ReferenceAttribute).props()).toEqual(props);
108
+ var props = { attributeValue: attributeValue, attributeType: attributeType, expanded: true };
109
+ setUp({ props: props });
110
+ react_2.screen.getByText('Nested test label');
111
+ react_2.screen.getByText('First Name');
112
+ react_2.screen.getByText('some string');
68
113
  });
114
+ it('should render reference attribute correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
115
+ var attributeType, attributeValue, metadata, props, mdmValues;
116
+ return __generator(this, function (_a) {
117
+ attributeType = {
118
+ label: 'Address',
119
+ name: 'Address',
120
+ type: 'Reference',
121
+ referencedAttributeURIs: [
122
+ 'configuration/relationTypes/HasAddress/attributes/AddressType',
123
+ 'configuration/entityTypes/Location/attributes/AddressLine1'
124
+ ],
125
+ uri: 'configuration/entityTypes/HCO/attributes/Address'
126
+ };
127
+ attributeValue = {
128
+ label: 'Reference Address',
129
+ relationshipLabel: 'Relationship label',
130
+ refEntity: {
131
+ objectURI: 'entities/2EpaVt0k',
132
+ type: 'configuration/entityTypes/Location',
133
+ crosswalks: []
134
+ },
135
+ refRelation: {
136
+ objectURI: 'relations/1GrMXM4O',
137
+ type: 'configuration/relationTypes/HasAddress',
138
+ crosswalks: []
139
+ },
140
+ uri: 'entities/2Vek4DnE/attributes/Address/1GrMXM4O',
141
+ value: {
142
+ AddressLine1: [
143
+ {
144
+ ov: true,
145
+ type: 'configuration/entityTypes/Location/attributes/AddressLine1',
146
+ uri: 'entities/2Vek4DnE/attributes/Address/1GrMXM4O/AddressLine1/2GcBL4K00',
147
+ value: 'Lenina street'
148
+ }
149
+ ],
150
+ AddressType: [
151
+ {
152
+ type: 'configuration/relationTypes/HasAddress/attributes/AddressType',
153
+ uri: 'entities/2Vek4DnE/attributes/Address/1GrMXM4O/AddressType/15sHPBU8',
154
+ value: 'Office',
155
+ ov: 'true'
156
+ }
157
+ ]
158
+ }
159
+ };
160
+ metadata = {
161
+ entityTypes: [
162
+ {
163
+ uri: 'configuration/entityTypes/HCO',
164
+ attributes: [attributeType]
165
+ },
166
+ {
167
+ uri: 'configuration/entityTypes/Location',
168
+ attributes: [
169
+ {
170
+ label: 'Address Line 1',
171
+ name: 'AddressLine1',
172
+ type: 'String',
173
+ uri: 'configuration/entityTypes/Location/attributes/AddressLine1'
174
+ }
175
+ ]
176
+ }
177
+ ],
178
+ relationTypes: [
179
+ {
180
+ uri: 'configuration/relationTypes/HasAddress',
181
+ attributes: [
182
+ {
183
+ label: 'Address Type',
184
+ name: 'AddressType',
185
+ type: 'String',
186
+ uri: 'configuration/relationTypes/HasAddress/attributes/AddressType'
187
+ }
188
+ ]
189
+ }
190
+ ]
191
+ };
192
+ props = { attributeValue: attributeValue, attributeType: attributeType, expanded: true };
193
+ mdmValues = { metadata: metadata };
194
+ setUp({ props: props, mdmValues: mdmValues });
195
+ react_2.screen.getByText('Reference Address');
196
+ react_2.screen.getByText('Relationship label');
197
+ react_2.screen.getByText('Address Type');
198
+ react_2.screen.getByText('Office');
199
+ react_2.screen.getByText('Address Line 1');
200
+ react_2.screen.getByText('Lenina street');
201
+ return [2 /*return*/];
202
+ });
203
+ }); });
69
204
  });