@reltio/components 1.4.2050 → 1.4.2052

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 (187) hide show
  1. package/AttributeListItem/AttributeListItem.d.ts +1 -1
  2. package/ChartTooltip/ChartTooltip.js +3 -3
  3. package/ColumnsSettings/ColumnsSettings.d.ts +2 -1
  4. package/ColumnsSettings/ColumnsSettings.js +2 -2
  5. package/ColumnsSettings/ColumnsSettings.test.js +14 -0
  6. package/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
  7. package/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
  8. package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
  9. package/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
  10. package/DropDownMenuButton/DropDownMenuButton.js +1 -1
  11. package/HOCs/withAsyncMount/withAsyncMount.test.js +52 -52
  12. package/IgnoreButton/IgnoreButton.spec.js +109 -20
  13. package/Image/Image.d.ts +1 -1
  14. package/Image/Image.js +8 -8
  15. package/Image/Image.test.js +46 -51
  16. package/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
  17. package/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
  18. package/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
  19. package/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
  20. package/ImageAttributesLine/ImageAttributesLine.js +1 -1
  21. package/ImageAttributesLine/ImageAttributesLine.test.js +187 -193
  22. package/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
  23. package/ImageAttributesLine/imageAttributeValues.test-data.js +22 -0
  24. package/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +315 -298
  25. package/ImageDetailsView/ImageDetailsView.test.js +529 -55
  26. package/ImageDetailsView/attributes.test-data.d.ts +4 -1
  27. package/ImageDetailsView/attributes.test-data.js +98 -1
  28. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
  29. package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
  30. package/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
  31. package/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
  32. package/ImageDetailsView/helpers.test.js +4 -4
  33. package/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
  34. package/ImportButton/ImportButton.test.js +94 -24
  35. package/InlineAttributesList/InlineAttributesList.test.js +22 -62
  36. package/InlineAttributesList/attributes.test-data.d.ts +4 -2
  37. package/InlineAttributesList/attributes.test-data.js +40 -1
  38. package/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
  39. package/InlineAttributesPager/InlineAttributesPager.js +1 -4
  40. package/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
  41. package/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
  42. package/InlineComplexAttribute/InlineComplexAttribute.test.js +396 -182
  43. package/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
  44. package/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
  45. package/InlineReferenceAttribute/InlineReferenceAttribute.test.js +165 -107
  46. package/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +352 -346
  47. package/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +285 -194
  48. package/InternalLink/InternalLink.test.js +41 -11
  49. package/LookupEditor/LookupEditor.test.js +180 -44
  50. package/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
  51. package/MapChart/MapChart.js +3 -8
  52. package/MapChart/MapChart.test.js +152 -188
  53. package/MapChart/components/Legend/Legend.js +3 -3
  54. package/MaskingSwitcher/MaskingSwitcher.js +1 -1
  55. package/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
  56. package/SelectEditor/SelectEditor.d.ts +4 -10
  57. package/SelectEditor/SelectEditor.js +0 -4
  58. package/SelectEditor/SelectEditor.test.js +79 -9
  59. package/SelectionPopup/SelectionPopup.d.ts +2 -1
  60. package/SelectionPopup/SelectionPopup.js +3 -3
  61. package/SelectionPopup/SelectionPopup.spec.js +90 -30
  62. package/cjs/AttributeListItem/AttributeListItem.d.ts +1 -1
  63. package/cjs/ChartTooltip/ChartTooltip.js +3 -3
  64. package/cjs/ColumnsSettings/ColumnsSettings.d.ts +2 -1
  65. package/cjs/ColumnsSettings/ColumnsSettings.js +2 -2
  66. package/cjs/ColumnsSettings/ColumnsSettings.test.js +14 -0
  67. package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.d.ts +11 -26
  68. package/cjs/ColumnsSettings/components/ColumnListItem/ColumnListItem.js +0 -14
  69. package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.d.ts +2 -1
  70. package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.js +2 -2
  71. package/cjs/DropDownMenuButton/DropDownMenuButton.js +1 -1
  72. package/cjs/HOCs/withAsyncMount/withAsyncMount.test.js +56 -56
  73. package/cjs/IgnoreButton/IgnoreButton.spec.js +109 -20
  74. package/cjs/Image/Image.d.ts +1 -1
  75. package/cjs/Image/Image.js +8 -8
  76. package/cjs/Image/Image.test.js +46 -51
  77. package/cjs/ImageActionsOverlay/ImageActionsOverlay.js +2 -1
  78. package/cjs/ImageActionsOverlay/ImageActionsOverlay.test.js +207 -125
  79. package/cjs/ImageActionsOverlay/components/CheckedIcon/CheckedIcon.js +1 -1
  80. package/cjs/ImageAttributesGallery/ImageAttributesGallery.test.js +525 -281
  81. package/cjs/ImageAttributesLine/ImageAttributesLine.js +1 -1
  82. package/cjs/ImageAttributesLine/ImageAttributesLine.test.js +195 -224
  83. package/cjs/ImageAttributesLine/imageAttributeValues.test-data.d.ts +10 -0
  84. package/cjs/ImageAttributesLine/imageAttributeValues.test-data.js +23 -1
  85. package/cjs/ImageAttributesLineEditor/ImageAttributesLineEditor.test.js +316 -299
  86. package/cjs/ImageDetailsView/ImageDetailsView.test.js +529 -55
  87. package/cjs/ImageDetailsView/attributes.test-data.d.ts +4 -1
  88. package/cjs/ImageDetailsView/attributes.test-data.js +99 -2
  89. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.js +2 -2
  90. package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.js +1 -1
  91. package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.js +1 -1
  92. package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.js +1 -1
  93. package/cjs/ImageDetailsView/helpers.test.js +3 -3
  94. package/cjs/ImageGalleryDialog/ImageGalleryDialog.test.js +89 -46
  95. package/cjs/ImportButton/ImportButton.test.js +94 -24
  96. package/cjs/InlineAttributesList/InlineAttributesList.test.js +22 -62
  97. package/cjs/InlineAttributesList/attributes.test-data.d.ts +4 -2
  98. package/cjs/InlineAttributesList/attributes.test-data.js +41 -2
  99. package/cjs/InlineAttributesPager/InlineAttributesPager.d.ts +1 -2
  100. package/cjs/InlineAttributesPager/InlineAttributesPager.js +1 -4
  101. package/cjs/InlineAttributesPager/InlineAttributesPager.test.js +393 -183
  102. package/cjs/InlineComplexAttribute/InlineComplexAttribute.js +1 -1
  103. package/cjs/InlineComplexAttribute/InlineComplexAttribute.test.js +395 -204
  104. package/cjs/InlineImageAttribute/InlineImageAttribute.test.js +103 -55
  105. package/cjs/InlineNestedAttribute/InlineNestedAttribute.test.js +105 -43
  106. package/cjs/InlineReferenceAttribute/InlineReferenceAttribute.test.js +164 -106
  107. package/cjs/InlineSimpleAttribute/InlineSimpleAttribute.spec.js +351 -345
  108. package/cjs/InlineSimpleAttributeEditor/InlineSimpleAttributeEditor.test.js +307 -193
  109. package/cjs/InternalLink/InternalLink.test.js +40 -10
  110. package/cjs/LookupEditor/LookupEditor.test.js +178 -65
  111. package/cjs/LookupEditor/components/GroupedDropDownEditor/helpers.test.js +1 -1
  112. package/cjs/MapChart/MapChart.js +3 -8
  113. package/cjs/MapChart/MapChart.test.js +152 -188
  114. package/cjs/MapChart/components/Legend/Legend.js +3 -3
  115. package/cjs/MaskingSwitcher/MaskingSwitcher.js +1 -1
  116. package/cjs/MatchRulesBadge/MatchRulesBadge.test.js +93 -24
  117. package/cjs/SelectEditor/SelectEditor.d.ts +4 -10
  118. package/cjs/SelectEditor/SelectEditor.js +0 -4
  119. package/cjs/SelectEditor/SelectEditor.test.js +79 -9
  120. package/cjs/SelectionPopup/SelectionPopup.d.ts +2 -1
  121. package/cjs/SelectionPopup/SelectionPopup.js +3 -3
  122. package/cjs/SelectionPopup/SelectionPopup.spec.js +90 -30
  123. package/cjs/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
  124. package/cjs/hooks/useAsyncMount/useAsyncMount.js +1 -1
  125. package/hooks/useAsyncMount/useAsyncMount.d.ts +1 -1
  126. package/hooks/useAsyncMount/useAsyncMount.js +1 -1
  127. package/package.json +1 -1
  128. package/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
  129. package/HOCs/withTableContext/withTableContext.test.js +0 -41
  130. package/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
  131. package/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -98
  132. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
  133. package/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -99
  134. package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
  135. package/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -65
  136. package/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
  137. package/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -306
  138. package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
  139. package/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -134
  140. package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
  141. package/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -99
  142. package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
  143. package/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -36
  144. package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
  145. package/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -161
  146. package/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
  147. package/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -76
  148. package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
  149. package/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -104
  150. package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
  151. package/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -114
  152. package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
  153. package/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -177
  154. package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
  155. package/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -52
  156. package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
  157. package/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -37
  158. package/cjs/HOCs/withTableContext/withTableContext.test.d.ts +0 -1
  159. package/cjs/HOCs/withTableContext/withTableContext.test.js +0 -46
  160. package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.d.ts +0 -1
  161. package/cjs/ImageAttributesGallery/components/GalleryView/GalleryView.test.js +0 -103
  162. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.d.ts +0 -1
  163. package/cjs/ImageDetailsView/components/ImageDetailsViewCarousel/ImageDetailsViewCarousel.test.js +0 -104
  164. package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.d.ts +0 -1
  165. package/cjs/ImageDetailsView/components/ImageDetailsViewSidebar/ImageDetailsViewSidebar.test.js +0 -70
  166. package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.d.ts +0 -1
  167. package/cjs/ImageDetailsView/components/MetaInfo/MetaInfo.test.js +0 -311
  168. package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.d.ts +0 -1
  169. package/cjs/ImageDetailsView/components/MetaInfoForm/MetaInfoForm.test.js +0 -139
  170. package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.d.ts +0 -1
  171. package/cjs/ImageDetailsView/components/MetaInfoHeader/MetaInfoHeader.test.js +0 -104
  172. package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.d.ts +0 -1
  173. package/cjs/ImageDetailsView/components/MetaInfoItem/MetaInfoItem.test.js +0 -41
  174. package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.d.ts +0 -1
  175. package/cjs/ImageDetailsView/components/MetaInfoList/MetaInfoList.test.js +0 -166
  176. package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.d.ts +0 -1
  177. package/cjs/ImageDetailsView/components/Thumbnails/Thumbnails.test.js +0 -81
  178. package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.d.ts +0 -1
  179. package/cjs/InlineAttributesPager/components/InlineImageAttributesBlock/InlineImageAttributesBlock.test.js +0 -109
  180. package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.d.ts +0 -1
  181. package/cjs/InlineAttributesPager/components/InlineNestedAttributesBlock/InlineNestedAttributesBlock.test.js +0 -119
  182. package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.d.ts +0 -1
  183. package/cjs/InlineAttributesPager/components/InlineReferenceAttributesBlock/InlineReferenceAttributesBlock.test.js +0 -182
  184. package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.d.ts +0 -1
  185. package/cjs/InlineSimpleAttribute/components/CrosswalkMenuItem/CrosswalkMenuItem.spec.js +0 -57
  186. package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.d.ts +0 -1
  187. package/cjs/LookupEditor/components/GroupedDropDownEditor/GroupedDropDownEditor.test.js +0 -42
@@ -30,7 +30,7 @@ export var InlineComplexAttribute = function (_a) {
30
30
  }, [expandedFromContext]);
31
31
  var crosswalks = pipe(pickBy(function (val, attrUri) { return areOneHierarchyUris(attrUri, attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.uri); }), values, flatten, uniqBy(prop('uri')))(crosswalksMap);
32
32
  return (React.createElement(React.Fragment, null,
33
- React.createElement("div", { className: styles.root, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave },
33
+ React.createElement("div", { "data-reltio-id": "inline-complex-attribute", className: styles.root, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave },
34
34
  React.createElement(ArrowExpandButton, { onClick: function () { return setExpanded(function (value) { return !value; }); }, expanded: expanded }),
35
35
  React.createElement("span", null,
36
36
  label,
@@ -9,215 +9,429 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ 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);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ 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;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
22
47
  };
23
48
  import React from 'react';
24
- import { act } from 'react-dom/test-utils';
25
- import { shallow } from 'enzyme';
49
+ import { render, screen } from '@testing-library/react';
50
+ import userEvent from '@testing-library/user-event';
51
+ import { DndContext } from '@dnd-kit/core';
26
52
  import { createNewAttribute } from '@reltio/mdm-sdk';
27
- import { InlineComplexAttribute } from './InlineComplexAttribute';
28
53
  import { ComplexAttributeLabel } from '../ComplexAttributeLabel';
29
- import * as expandedContext from '../contexts/ExpandedAttributesContext';
30
- describe('InlineComplexAttribute tests', function () {
31
- var attributeType = {
32
- uri: 'configuration/entityTypes/HCP/attributes/Nested',
33
- type: 'Nested',
34
- name: 'Nested',
35
- label: 'Nested label',
36
- attributes: [
37
- {
38
- uri: 'configuration/entityTypes/HCP/attributes/Nested/attributes/SubNested',
39
- type: 'String',
40
- name: 'SubNested',
41
- label: 'SubNested label'
42
- }
43
- ],
44
- access: ['READ', 'UPDATE', 'DELETE']
45
- };
46
- var attributeValue = {
47
- type: attributeType.uri,
48
- uri: 'entities/1/attributes/Nested/1',
49
- value: {
50
- SubNested: [
51
- {
52
- uri: 'entities/1/attributes/Nested/1/SubNested/1',
53
- value: '1'
54
- }
55
- ]
56
- },
57
- ov: true
58
- };
59
- var crosswalks = [
60
- {
61
- uri: 'entities/1/crosswalks/12jf9nL05',
62
- type: 'configuration/sources/Reltio',
63
- value: 'nQpZyQt',
64
- reltioLoadDate: '2021-06-11T08:24:31.726Z',
65
- createDate: '2018-11-19T12:14:00.735Z',
66
- updateDate: '2018-11-19T12:14:00.735Z',
67
- attributes: ['entities/1/attributes/Nested/1'],
68
- singleAttributeUpdateDates: {
69
- 'entities/1/attributes/Nested/1': '2018-11-29T05:39:56.445Z'
70
- }
71
- },
54
+ import { useAttributeExpanded } from '../contexts/ExpandedAttributesContext';
55
+ import { MdmModuleProvider } from '../contexts/MdmModuleContext';
56
+ import { getMuiIconByName } from '../test-utils';
57
+ import { InlineComplexAttribute } from './InlineComplexAttribute';
58
+ jest.mock('../contexts/ExpandedAttributesContext', function () { return ({
59
+ useAttributeExpanded: jest.fn()
60
+ }); });
61
+ var attributeType = {
62
+ uri: 'configuration/entityTypes/HCP/attributes/Nested',
63
+ type: 'Nested',
64
+ name: 'Nested',
65
+ label: 'Nested label',
66
+ attributes: [
72
67
  {
73
- uri: 'entities/1/crosswalks/1CwTinUzm',
74
- type: 'configuration/sources/AHA',
75
- value: 'AHA_LEV',
76
- reltioLoadDate: '2021-06-09T11:32:16.434Z',
77
- sourcePublishDate: '1970-01-01T00:00:00.000Z',
78
- createDate: '2018-11-28T13:16:18.540Z',
79
- updateDate: '2018-11-28T13:16:18.540Z',
80
- attributes: ['entities/1/attributes/Nested/1/SubNested/1'],
81
- singleAttributeUpdateDates: {
82
- 'entities/1/attributes/Nested/1/SubNested/1': '2021-06-09T11:32:16.434Z'
83
- }
68
+ uri: 'configuration/entityTypes/HCP/attributes/Nested/attributes/SubNested',
69
+ type: 'String',
70
+ name: 'SubNested',
71
+ label: 'SubNested label'
84
72
  }
85
- ];
86
- var crosswalksMap = {
87
- 'entities/1/attributes/Nested/1': [crosswalks[0]],
88
- 'entities/1/attributes/Nested/1/SubNested/1': [crosswalks[1]]
89
- };
90
- var props = {
91
- attributeType: attributeType,
92
- attributeValue: attributeValue,
93
- attributeTypesList: attributeType.attributes,
94
- label: React.createElement(ComplexAttributeLabel, null, '<No Label>'),
95
- crosswalksMap: crosswalksMap,
96
- onPin: jest.fn(),
97
- onIgnore: jest.fn(),
98
- onEdit: jest.fn(),
99
- onDelete: jest.fn(),
100
- onAdd: jest.fn(),
101
- emptyTempAttributeUris: []
73
+ ],
74
+ access: ['READ', 'UPDATE', 'DELETE']
75
+ };
76
+ var attributeValue = {
77
+ type: attributeType.uri,
78
+ uri: 'entities/1/attributes/Nested/1',
79
+ value: {
80
+ SubNested: [{ uri: 'entities/1/attributes/Nested/1/SubNested/1', value: '1' }]
81
+ },
82
+ ov: true
83
+ };
84
+ var crosswalks = [
85
+ {
86
+ uri: 'entities/1/crosswalks/12jf9nL05',
87
+ type: 'configuration/sources/Reltio',
88
+ value: 'nQpZyQt',
89
+ reltioLoadDate: '2021-06-11T08:24:31.726Z',
90
+ createDate: '2018-11-19T12:14:00.735Z',
91
+ updateDate: '2018-11-19T12:14:00.735Z',
92
+ attributes: ['entities/1/attributes/Nested/1'],
93
+ singleAttributeUpdateDates: {
94
+ 'entities/1/attributes/Nested/1': '2018-11-29T05:39:56.445Z'
95
+ }
96
+ },
97
+ {
98
+ uri: 'entities/1/crosswalks/1CwTinUzm',
99
+ type: 'configuration/sources/AHA',
100
+ value: 'AHA_LEV',
101
+ reltioLoadDate: '2021-06-09T11:32:16.434Z',
102
+ sourcePublishDate: '1970-01-01T00:00:00.000Z',
103
+ createDate: '2018-11-28T13:16:18.540Z',
104
+ updateDate: '2018-11-28T13:16:18.540Z',
105
+ attributes: ['entities/1/attributes/Nested/1/SubNested/1'],
106
+ singleAttributeUpdateDates: {
107
+ 'entities/1/attributes/Nested/1/SubNested/1': '2021-06-09T11:32:16.434Z'
108
+ }
109
+ }
110
+ ];
111
+ var crosswalksMap = {
112
+ 'entities/1/attributes/Nested/1': [crosswalks[0]],
113
+ 'entities/1/attributes/Nested/1/SubNested/1': [crosswalks[1]]
114
+ };
115
+ var metadata = {
116
+ entityTypes: [],
117
+ sources: []
118
+ };
119
+ var defaultProps = {
120
+ attributeType: attributeType,
121
+ attributeValue: attributeValue,
122
+ attributeTypesList: attributeType.attributes,
123
+ label: React.createElement(ComplexAttributeLabel, null, '<No Label>'),
124
+ crosswalksMap: crosswalksMap,
125
+ onPin: jest.fn(),
126
+ onIgnore: jest.fn(),
127
+ onEdit: jest.fn(),
128
+ onDelete: jest.fn(),
129
+ onAdd: jest.fn(),
130
+ emptyTempAttributeUris: []
131
+ };
132
+ var setUp = function (props) {
133
+ if (props === void 0) { props = {}; }
134
+ var user = userEvent.setup({ skipHover: true });
135
+ var Providers = function (_a) {
136
+ var children = _a.children;
137
+ return (React.createElement(MdmModuleProvider, { values: { metadata: metadata } },
138
+ React.createElement(DndContext, null, children)));
102
139
  };
103
- var useAttributeExpandedMock = jest.spyOn(expandedContext, 'useAttributeExpanded').mockReturnValue(false);
140
+ return __assign({ user: user }, render(React.createElement(InlineComplexAttribute, __assign({}, defaultProps, props)), { wrapper: Providers }));
141
+ };
142
+ describe('InlineComplexAttribute tests', function () {
143
+ beforeEach(function () {
144
+ jest.clearAllMocks();
145
+ useAttributeExpanded.mockReturnValue(false);
146
+ });
104
147
  it('should render correctly', function () {
105
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props)));
106
- expect(wrapper.find('ArrowExpandButton').prop('expanded')).toBe(false);
107
- expect(wrapper.find(ComplexAttributeLabel).prop('children')).toBe('<No Label>');
108
- var crosswalkIcons = wrapper.find('CrosswalkIcon');
109
- expect(crosswalkIcons).toHaveLength(crosswalks.length);
110
- crosswalkIcons.forEach(function (icon, index) {
111
- expect(icon.prop('crosswalk')).toEqual(crosswalks[index]);
112
- });
113
- expect(wrapper.find('PinButton').prop('isPinned')).toBe(undefined);
114
- expect(wrapper.find('PinButton').prop('disabled')).toBe(false);
115
- expect(wrapper.find('IgnoreButton').prop('isIgnored')).toBe(undefined);
116
- expect(wrapper.find('IgnoreButton').prop('disabled')).toBe(false);
117
- expect(wrapper.find('DeleteButton')).toHaveLength(1);
118
- expect(wrapper.find('InlineAttributesList')).toHaveLength(0);
148
+ setUp();
149
+ expect(screen.getByText('<No Label>')).toBeInTheDocument();
150
+ var crosswalks = screen.getAllByTestId('crosswalk-icon');
151
+ expect(crosswalks).toHaveLength(2);
152
+ expect(screen.queryByLabelText('Pin')).not.toBeInTheDocument();
153
+ expect(screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
154
+ expect(screen.queryByLabelText('Delete')).not.toBeInTheDocument();
155
+ expect(screen.getByTestId('arrow-expand-button')).toBeInTheDocument();
156
+ expect(screen.getByTestId('arrow-expand-button').querySelector('svg')).not.toHaveClass('expanded');
157
+ expect(screen.queryByTestId('branch-decorator')).not.toBeInTheDocument();
119
158
  });
120
- it('should show InlineAttributesList on arrow button click', function () {
121
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props)));
122
- act(function () {
123
- wrapper.find('ArrowExpandButton').simulate('click');
159
+ it('should render actions on hover', function () { return __awaiter(void 0, void 0, void 0, function () {
160
+ var user;
161
+ return __generator(this, function (_a) {
162
+ switch (_a.label) {
163
+ case 0:
164
+ user = setUp().user;
165
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
166
+ case 1:
167
+ _a.sent();
168
+ return [4 /*yield*/, screen.findByLabelText('Pin')];
169
+ case 2:
170
+ _a.sent();
171
+ expect(screen.getByLabelText('Pin').firstChild).not.toBeDisabled();
172
+ expect(screen.getByTestId('SvgPinOutlined')).toBeInTheDocument();
173
+ expect(screen.getByLabelText('Ignore').firstChild).not.toBeDisabled();
174
+ expect(screen.getByTestId('SvgIgnoredOutlined')).toBeInTheDocument();
175
+ expect(screen.getByLabelText('Delete')).toBeInTheDocument();
176
+ expect(getMuiIconByName('Delete')).toBeInTheDocument();
177
+ return [2 /*return*/];
178
+ }
124
179
  });
125
- expect(wrapper.find('ArrowExpandButton').prop('expanded')).toBe(true);
126
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
127
- var attributeTypesList = props.attributeTypesList, attributeValue = props.attributeValue, attributeType = props.attributeType, label = props.label, other = __rest(props, ["attributeTypesList", "attributeValue", "attributeType", "label"]);
128
- expect(wrapper.find('InlineAttributesList').props()).toEqual(__assign({ attributeTypes: attributeTypesList, parentUri: attributeValue.uri, attributes: attributeValue.value, disableEdit: false, disableDelete: false }, other));
129
- });
180
+ }); });
181
+ it('should show InlineAttributesList on arrow button click', function () { return __awaiter(void 0, void 0, void 0, function () {
182
+ var user;
183
+ return __generator(this, function (_a) {
184
+ switch (_a.label) {
185
+ case 0:
186
+ user = setUp().user;
187
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
188
+ case 1:
189
+ _a.sent();
190
+ expect(screen.getByTestId('arrow-expand-button').querySelector('svg')).toHaveClass('expanded');
191
+ expect(screen.getByTestId('branch-decorator')).toBeInTheDocument();
192
+ expect(screen.getByText('SubNested label')).toBeInTheDocument();
193
+ return [4 /*yield*/, user.hover(screen.getByTestId('value-index-0'))];
194
+ case 2:
195
+ _a.sent();
196
+ return [4 /*yield*/, screen.findByLabelText('Pin')];
197
+ case 3:
198
+ _a.sent();
199
+ expect(screen.getByLabelText('Pin').firstChild).not.toBeDisabled();
200
+ expect(screen.getByTestId('SvgPinOutlined')).toBeInTheDocument();
201
+ expect(screen.getByLabelText('Ignore').firstChild).not.toBeDisabled();
202
+ expect(screen.getByTestId('SvgIgnoredOutlined')).toBeInTheDocument();
203
+ expect(screen.getByLabelText('More actions')).toBeInTheDocument();
204
+ return [2 /*return*/];
205
+ }
206
+ });
207
+ }); });
130
208
  it('should show pin button if attribute value has pin: true', function () {
131
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { attributeValue: __assign(__assign({}, attributeValue), { pin: true }) })));
132
- expect(wrapper.find('PinButton').prop('isPinned')).toBe(true);
209
+ setUp({ attributeValue: __assign(__assign({}, attributeValue), { pin: true }) });
210
+ expect(screen.getByLabelText('Pin')).toBeInTheDocument();
211
+ expect(screen.getByTestId('SvgPin')).toBeInTheDocument();
133
212
  });
134
213
  it('should show disabled pin button if attribute value has pin: true, but editing is disabled', function () {
135
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { disableEdit: true, attributeValue: __assign(__assign({}, attributeValue), { pin: true }) })));
136
- expect(wrapper.find('PinButton').prop('isPinned')).toBe(true);
137
- expect(wrapper.find('PinButton').prop('disabled')).toBe(true);
214
+ setUp({ attributeValue: __assign(__assign({}, attributeValue), { pin: true }), disableEdit: true });
215
+ expect(screen.getByLabelText("You don't have permissions to pin").firstChild).toBeDisabled();
216
+ expect(screen.getByTestId('SvgPin')).toBeInTheDocument();
138
217
  });
139
218
  it('should show ignore button if attribute value has ignored: true', function () {
140
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { attributeValue: __assign(__assign({}, attributeValue), { ignored: true }) })));
141
- expect(wrapper.find('IgnoreButton').prop('isIgnored')).toBe(true);
219
+ setUp({ attributeValue: __assign(__assign({}, attributeValue), { ignored: true }) });
220
+ expect(screen.getByLabelText('Ignore')).toBeInTheDocument();
221
+ expect(screen.getByTestId('SvgIgnored')).toBeInTheDocument();
142
222
  });
143
223
  it('should show disabled ignore button if attribute value has ignored: true but editing is disabled', function () {
144
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { disableEdit: true, attributeValue: __assign(__assign({}, attributeValue), { ignored: true }) })));
145
- expect(wrapper.find('IgnoreButton').prop('isIgnored')).toBe(true);
146
- expect(wrapper.find('IgnoreButton').prop('disabled')).toBe(true);
224
+ setUp({ attributeValue: __assign(__assign({}, attributeValue), { ignored: true }), disableEdit: true });
225
+ expect(screen.getByLabelText("You don't have permissions to ignore").firstChild).toBeDisabled();
226
+ expect(screen.getByTestId('SvgIgnored')).toBeInTheDocument();
147
227
  });
148
- it('should hide delete button, disallow children deletion if props.disableDelete is true', function () {
149
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { disableDelete: true })));
150
- expect(wrapper.find('DeleteButton')).toHaveLength(0);
151
- act(function () {
152
- wrapper.find('ArrowExpandButton').simulate('click');
228
+ it('should hide delete button, disallow children deletion if props.disableDelete is true', function () { return __awaiter(void 0, void 0, void 0, function () {
229
+ var user;
230
+ return __generator(this, function (_a) {
231
+ switch (_a.label) {
232
+ case 0:
233
+ user = setUp({ disableDelete: true }).user;
234
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
235
+ case 1:
236
+ _a.sent();
237
+ return [4 /*yield*/, screen.findByLabelText('Pin')];
238
+ case 2:
239
+ _a.sent();
240
+ expect(screen.queryByLabelText('Delete')).not.toBeInTheDocument();
241
+ return [2 /*return*/];
242
+ }
153
243
  });
154
- expect(wrapper.find('InlineAttributesList').prop('disableDelete')).toBe(true);
155
- });
156
- it('should hide ignore and pin button, disallow children editing if props.disableEdit is true', function () {
157
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { disableEdit: true })));
158
- expect(wrapper.find('PinButton')).toHaveLength(0);
159
- expect(wrapper.find('IgnoreButton')).toHaveLength(0);
160
- act(function () {
161
- wrapper.find('ArrowExpandButton').simulate('click');
244
+ }); });
245
+ it('should hide ignore and pin button, disallow children editing if props.disableEdit is true', function () { return __awaiter(void 0, void 0, void 0, function () {
246
+ var user, _a, _b;
247
+ return __generator(this, function (_c) {
248
+ switch (_c.label) {
249
+ case 0:
250
+ user = setUp({ disableEdit: true }).user;
251
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
252
+ case 1:
253
+ _c.sent();
254
+ return [4 /*yield*/, screen.findByLabelText('Delete')];
255
+ case 2:
256
+ _c.sent();
257
+ expect(screen.queryByLabelText('Pin')).not.toBeInTheDocument();
258
+ expect(screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
259
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
260
+ case 3:
261
+ _c.sent();
262
+ return [4 /*yield*/, user.hover(screen.getByTestId('value-index-0'))];
263
+ case 4:
264
+ _c.sent();
265
+ _b = (_a = user).click;
266
+ return [4 /*yield*/, screen.findByLabelText('More actions')];
267
+ case 5: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
268
+ case 6:
269
+ _c.sent();
270
+ expect(screen.getByText('Edit').parentElement).toHaveAttribute('aria-disabled', 'true');
271
+ expect(screen.getByText('Delete').parentElement).not.toHaveAttribute('aria-disabled', 'true');
272
+ return [2 /*return*/];
273
+ }
162
274
  });
163
- expect(wrapper.find('InlineAttributesList').prop('disableEdit')).toBe(true);
164
- });
165
- it('should hide delete button, disable children deletion if attributeType has no delete permissions', function () {
166
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { attributeType: __assign(__assign({}, attributeType), { access: ['READ', 'UPDATE'] }) })));
167
- expect(wrapper.find('DeleteButton')).toHaveLength(0);
168
- act(function () {
169
- wrapper.find('ArrowExpandButton').simulate('click');
275
+ }); });
276
+ it('should hide delete button, disable children deletion if attributeType has no delete permissions', function () { return __awaiter(void 0, void 0, void 0, function () {
277
+ var user, _a, _b;
278
+ return __generator(this, function (_c) {
279
+ switch (_c.label) {
280
+ case 0:
281
+ user = setUp({
282
+ attributeType: __assign(__assign({}, attributeType), { access: ['READ', 'UPDATE'] })
283
+ }).user;
284
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
285
+ case 1:
286
+ _c.sent();
287
+ return [4 /*yield*/, screen.findByLabelText('Pin')];
288
+ case 2:
289
+ _c.sent();
290
+ expect(screen.queryByLabelText('Delete')).not.toBeInTheDocument();
291
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
292
+ case 3:
293
+ _c.sent();
294
+ return [4 /*yield*/, user.hover(screen.getByTestId('value-index-0'))];
295
+ case 4:
296
+ _c.sent();
297
+ _b = (_a = user).click;
298
+ return [4 /*yield*/, screen.findByLabelText('More actions')];
299
+ case 5: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
300
+ case 6:
301
+ _c.sent();
302
+ expect(screen.getByText('Edit').parentElement).not.toHaveAttribute('aria-disabled', 'true');
303
+ expect(screen.getByText('Delete').parentElement).toHaveAttribute('aria-disabled', 'true');
304
+ return [2 /*return*/];
305
+ }
170
306
  });
171
- expect(wrapper.find('InlineAttributesList').prop('disableDelete')).toBe(true);
172
- });
173
- it('should hide ignore and pin button, disable children editing if attribute type has no update permissions', function () {
174
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { attributeType: __assign(__assign({}, attributeType), { access: ['READ', 'DELETE'] }) })));
175
- expect(wrapper.find('PinButton')).toHaveLength(0);
176
- expect(wrapper.find('IgnoreButton')).toHaveLength(0);
177
- act(function () {
178
- wrapper.find('ArrowExpandButton').simulate('click');
307
+ }); });
308
+ it('should hide ignore and pin button, disable children editing if attribute type has no update permissions', function () { return __awaiter(void 0, void 0, void 0, function () {
309
+ var user, _a, _b;
310
+ return __generator(this, function (_c) {
311
+ switch (_c.label) {
312
+ case 0:
313
+ user = setUp({
314
+ attributeType: __assign(__assign({}, attributeType), { access: ['READ', 'DELETE'] })
315
+ }).user;
316
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
317
+ case 1:
318
+ _c.sent();
319
+ return [4 /*yield*/, screen.findByLabelText('Delete')];
320
+ case 2:
321
+ _c.sent();
322
+ expect(screen.queryByLabelText('Pin')).not.toBeInTheDocument();
323
+ expect(screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
324
+ return [4 /*yield*/, user.click(screen.getByTestId('arrow-expand-button'))];
325
+ case 3:
326
+ _c.sent();
327
+ return [4 /*yield*/, user.hover(screen.getByTestId('value-index-0'))];
328
+ case 4:
329
+ _c.sent();
330
+ _b = (_a = user).click;
331
+ return [4 /*yield*/, screen.findByLabelText('More actions')];
332
+ case 5: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
333
+ case 6:
334
+ _c.sent();
335
+ expect(screen.getByText('Edit').parentElement).toHaveAttribute('aria-disabled', 'true');
336
+ expect(screen.getByText('Delete').parentElement).not.toHaveAttribute('aria-disabled', 'true');
337
+ return [2 /*return*/];
338
+ }
179
339
  });
180
- expect(wrapper.find('InlineAttributesList').prop('disableEdit')).toBe(true);
181
- });
182
- it('should call props.onDelete on Delete button click correctly', function () {
183
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props)));
184
- wrapper.find('DeleteButton').simulate('click');
185
- expect(props.onDelete).toHaveBeenCalledWith({
186
- attributeType: attributeType,
187
- attributeValue: attributeValue,
188
- crosswalks: [crosswalks[0]]
340
+ }); });
341
+ it('should call props.onDelete on Delete button click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
342
+ var user, _a, _b;
343
+ return __generator(this, function (_c) {
344
+ switch (_c.label) {
345
+ case 0:
346
+ user = setUp().user;
347
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
348
+ case 1:
349
+ _c.sent();
350
+ _b = (_a = user).click;
351
+ return [4 /*yield*/, screen.findByLabelText('Delete')];
352
+ case 2: return [4 /*yield*/, _b.apply(_a, [_c.sent()])];
353
+ case 3:
354
+ _c.sent();
355
+ expect(defaultProps.onDelete).toHaveBeenCalledWith({
356
+ attributeType: attributeType,
357
+ attributeValue: attributeValue,
358
+ crosswalks: [crosswalks[0]]
359
+ });
360
+ return [2 /*return*/];
361
+ }
189
362
  });
190
- });
191
- it('should call props.onPin on Pin button click correctly', function () {
192
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props)));
193
- wrapper.find('PinButton').simulate('click');
194
- expect(props.onPin).toHaveBeenCalledWith({
195
- attributeValue: attributeValue
363
+ }); });
364
+ it('should call props.onPin on Pin button click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
365
+ var user, _a, _b;
366
+ return __generator(this, function (_c) {
367
+ switch (_c.label) {
368
+ case 0:
369
+ user = setUp().user;
370
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
371
+ case 1:
372
+ _c.sent();
373
+ _b = (_a = user).click;
374
+ return [4 /*yield*/, screen.findByLabelText('Pin')];
375
+ case 2: return [4 /*yield*/, _b.apply(_a, [(_c.sent()).firstChild])];
376
+ case 3:
377
+ _c.sent();
378
+ expect(defaultProps.onPin).toHaveBeenCalledWith({ attributeValue: attributeValue });
379
+ return [2 /*return*/];
380
+ }
196
381
  });
197
- });
198
- it('should call props.onIgnore on Ignore button click correctly', function () {
199
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props)));
200
- wrapper.find('IgnoreButton').simulate('click');
201
- expect(props.onIgnore).toHaveBeenCalledWith({
202
- attributeValue: attributeValue
382
+ }); });
383
+ it('should call props.onIgnore on Ignore button click correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
384
+ var user, _a, _b;
385
+ return __generator(this, function (_c) {
386
+ switch (_c.label) {
387
+ case 0:
388
+ user = setUp().user;
389
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
390
+ case 1:
391
+ _c.sent();
392
+ _b = (_a = user).click;
393
+ return [4 /*yield*/, screen.findByLabelText('Ignore')];
394
+ case 2: return [4 /*yield*/, _b.apply(_a, [(_c.sent()).firstChild])];
395
+ case 3:
396
+ _c.sent();
397
+ expect(defaultProps.onIgnore).toHaveBeenCalledWith({ attributeValue: attributeValue });
398
+ return [2 /*return*/];
399
+ }
203
400
  });
204
- });
401
+ }); });
205
402
  it('should render temporary attribute expanded by default', function () {
206
- var tempAttribute = createNewAttribute({ attributeType: attributeType, parentUri: 'entities/1' });
207
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { attributeValue: tempAttribute })));
208
- expect(wrapper.find('ArrowExpandButton').prop('expanded')).toBe(true);
209
- expect(wrapper.find('InlineAttributesList')).toHaveLength(1);
210
- });
211
- it('should hide ignore and pin buttons for temporary attribute', function () {
212
- var tempAttribute = createNewAttribute({ attributeType: attributeType, parentUri: 'entities/1' });
213
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props, { attributeValue: tempAttribute })));
214
- expect(wrapper.find('PinButton')).toHaveLength(0);
215
- expect(wrapper.find('IgnoreButton')).toHaveLength(0);
403
+ useAttributeExpanded.mockReturnValueOnce(true);
404
+ setUp();
405
+ expect(screen.getByTestId('arrow-expand-button').querySelector('svg')).toHaveClass('expanded');
406
+ expect(screen.getByTestId('branch-decorator')).toBeInTheDocument();
407
+ expect(screen.getByText('SubNested label')).toBeInTheDocument();
408
+ expect(screen.getByTestId('simple-attributes-wrapper')).toBeInTheDocument();
216
409
  });
410
+ it('should hide ignore and pin buttons for temporary attribute', function () { return __awaiter(void 0, void 0, void 0, function () {
411
+ var user;
412
+ return __generator(this, function (_a) {
413
+ switch (_a.label) {
414
+ case 0:
415
+ useAttributeExpanded.mockReturnValueOnce(true);
416
+ user = setUp({ attributeValue: createNewAttribute({ attributeType: attributeType, parentUri: 'entities/1' }) }).user;
417
+ return [4 /*yield*/, user.hover(screen.getByTestId('inline-complex-attribute'))];
418
+ case 1:
419
+ _a.sent();
420
+ return [4 /*yield*/, screen.findByLabelText('Delete')];
421
+ case 2:
422
+ _a.sent();
423
+ expect(screen.queryByLabelText('Pin')).not.toBeInTheDocument();
424
+ expect(screen.queryByLabelText('Ignore')).not.toBeInTheDocument();
425
+ return [2 /*return*/];
426
+ }
427
+ });
428
+ }); });
217
429
  it('should render attribute expanded by default if it is expanded via context', function () {
218
- useAttributeExpandedMock.mockReturnValueOnce(true);
219
- var wrapper = shallow(React.createElement(InlineComplexAttribute, __assign({}, props)));
220
- expect(wrapper.find('ArrowExpandButton').prop('expanded')).toBe(true);
221
- expect(wrapper.find('InlineAttributesList')).toHaveLength(1);
430
+ useAttributeExpanded.mockReturnValueOnce(true);
431
+ setUp();
432
+ expect(screen.getByTestId('arrow-expand-button').querySelector('svg')).toHaveClass('expanded');
433
+ expect(screen.getByTestId('branch-decorator')).toBeInTheDocument();
434
+ expect(screen.getByText('SubNested label')).toBeInTheDocument();
435
+ expect(screen.getByTestId('simple-attributes-wrapper')).toBeInTheDocument();
222
436
  });
223
437
  });