@reltio/components 1.4.2051 → 1.4.2053

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