@reltio/components 1.4.1905 → 1.4.1907

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 (105) hide show
  1. package/cjs/ActionsPanel/ActionsPanel.test.js +133 -49
  2. package/cjs/AttributeListItem/AttributeListItem.spec.js +147 -118
  3. package/cjs/AttributeSelector/AttributeSelector.specs.js +125 -193
  4. package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
  5. package/cjs/AttributesErrorsPanel/components/Error/Error.specs.js +96 -90
  6. package/cjs/AttributesErrorsPanel/store.test-data.d.ts +22 -0
  7. package/cjs/AttributesErrorsPanel/store.test-data.js +29 -0
  8. package/cjs/AttributesFilterSelector/AttributesFilterSelector.test.js +127 -105
  9. package/cjs/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
  10. package/cjs/AttributesValuesEditor/AttributesValuesEditor.test.js +92 -88
  11. package/cjs/AttributesView/AttributesView.test.js +67 -34
  12. package/cjs/AutoSizeList/AutoSizeList.test.js +81 -59
  13. package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +15 -31
  14. package/cjs/BarChart/BarChart.test.js +128 -65
  15. package/cjs/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
  16. package/cjs/BasicViewContent/BasicViewContent.test.js +7 -9
  17. package/cjs/BlobRenderer/BlobRenderer.test.js +28 -9
  18. package/cjs/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
  19. package/cjs/BubbleChart/BubbleChart.test.js +111 -87
  20. package/cjs/CloudChart/CloudChart.test.js +95 -36
  21. package/cjs/CollaborationItem/CollaborationItem.test.js +67 -30
  22. package/cjs/CollaborationItem/components/Comment/Comment.test.js +221 -189
  23. package/cjs/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -81
  24. package/cjs/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
  25. package/cjs/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
  26. package/cjs/CollapseButton/CollapseButton.test.js +74 -15
  27. package/cjs/CollapseRowButton/CollapseRowButton.test.js +82 -24
  28. package/cjs/ColorBar/ColorBar.test.js +13 -15
  29. package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
  30. package/cjs/CommentsContainer/CommentsContainer.test.js +282 -211
  31. package/cjs/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +183 -122
  32. package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
  33. package/cjs/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
  34. package/cjs/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
  35. package/cjs/ConnectionEditor/ConnectionEditor.test.js +299 -282
  36. package/cjs/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +3 -1
  37. package/cjs/ReactSortableTree/ReactSortableTree.js +2 -7
  38. package/cjs/RelationTypeSelector/RelationTypeSelector.d.ts +3 -1
  39. package/cjs/types/index.d.ts +1 -1
  40. package/esm/ActionsPanel/ActionsPanel.test.js +133 -49
  41. package/esm/AttributeListItem/AttributeListItem.spec.js +149 -97
  42. package/esm/AttributeSelector/AttributeSelector.specs.js +125 -193
  43. package/esm/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
  44. package/esm/AttributesErrorsPanel/components/Error/Error.specs.js +98 -72
  45. package/esm/AttributesErrorsPanel/store.test-data.d.ts +22 -0
  46. package/esm/AttributesErrorsPanel/store.test-data.js +26 -0
  47. package/esm/AttributesFilterSelector/AttributesFilterSelector.test.js +129 -84
  48. package/esm/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
  49. package/esm/AttributesValuesEditor/AttributesValuesEditor.test.js +94 -67
  50. package/esm/AttributesView/AttributesView.test.js +67 -34
  51. package/esm/AutoSizeList/AutoSizeList.test.js +81 -59
  52. package/esm/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +16 -32
  53. package/esm/BarChart/BarChart.test.js +128 -65
  54. package/esm/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
  55. package/esm/BasicViewContent/BasicViewContent.test.js +7 -9
  56. package/esm/BlobRenderer/BlobRenderer.test.js +28 -9
  57. package/esm/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
  58. package/esm/BubbleChart/BubbleChart.test.js +111 -87
  59. package/esm/CloudChart/CloudChart.test.js +95 -36
  60. package/esm/CollaborationItem/CollaborationItem.test.js +67 -30
  61. package/esm/CollaborationItem/components/Comment/Comment.test.js +221 -189
  62. package/esm/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -58
  63. package/esm/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
  64. package/esm/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
  65. package/esm/CollapseButton/CollapseButton.test.js +74 -15
  66. package/esm/CollapseRowButton/CollapseRowButton.test.js +82 -24
  67. package/esm/ColorBar/ColorBar.test.js +13 -15
  68. package/esm/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
  69. package/esm/CommentsContainer/CommentsContainer.test.js +282 -211
  70. package/esm/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +182 -101
  71. package/esm/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
  72. package/esm/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
  73. package/esm/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
  74. package/esm/ConnectionEditor/ConnectionEditor.test.js +300 -283
  75. package/esm/ConnectionRelationTypeSelector/ConnectionRelationTypeSelector.d.ts +3 -1
  76. package/esm/ReactSortableTree/ReactSortableTree.js +2 -7
  77. package/esm/RelationTypeSelector/RelationTypeSelector.d.ts +3 -1
  78. package/esm/types/index.d.ts +1 -1
  79. package/package.json +2 -2
  80. package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -100
  81. package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
  82. package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -46
  83. package/cjs/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
  84. package/cjs/AvatarWithFallback/AvatarWithFallback.specs.js +0 -27
  85. package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
  86. package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -27
  87. package/cjs/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
  88. package/cjs/CollaborationItem/components/Avatar/Avatar.test.js +0 -15
  89. package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
  90. package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -80
  91. package/esm/ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts +0 -1
  92. package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts +0 -1
  93. package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -95
  94. package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
  95. package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -41
  96. package/esm/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
  97. package/esm/AvatarWithFallback/AvatarWithFallback.specs.js +0 -22
  98. package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
  99. package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -22
  100. package/esm/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
  101. package/esm/CollaborationItem/components/Avatar/Avatar.test.js +0 -10
  102. package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
  103. package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -55
  104. /package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts → AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
  105. /package/{cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts → esm/AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
@@ -10,72 +10,109 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
13
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
51
  };
16
52
  Object.defineProperty(exports, "__esModule", { value: true });
17
53
  var react_1 = __importDefault(require("react"));
18
- var enzyme_1 = require("enzyme");
19
- var Button_1 = __importDefault(require("@mui/material/Button"));
20
- var Dialog_1 = __importDefault(require("@mui/material/Dialog"));
21
- var DialogActions_1 = __importDefault(require("@mui/material/DialogActions"));
22
- var DialogContent_1 = __importDefault(require("@mui/material/DialogContent"));
23
- var DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
54
+ var user_event_1 = __importDefault(require("@testing-library/user-event"));
55
+ var react_2 = require("@testing-library/react");
24
56
  var ConfirmationDialog_1 = require("./ConfirmationDialog");
25
57
  describe('ConfirmationDialog tests', function () {
26
- var props = {
58
+ var onCancel = jest.fn();
59
+ var onDiscard = jest.fn();
60
+ var onSave = jest.fn();
61
+ var defaultProps = {
27
62
  open: true,
28
63
  title: '123',
29
64
  content: 'content',
30
- onCancel: jest.fn(),
65
+ onCancel: onCancel,
31
66
  cancelCaption: 'cancel caption',
32
- onDiscard: jest.fn(),
67
+ onDiscard: onDiscard,
33
68
  discardCaption: 'discard caption',
34
- onSave: jest.fn(),
69
+ onSave: onSave,
35
70
  saveCaption: 'save caption'
36
71
  };
37
- it('should render main parts', function () {
38
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, __assign({}, props)));
39
- var dialog = component.find(Dialog_1.default);
40
- expect(dialog.length).toBe(1);
41
- expect(dialog.find(DialogTitle_1.default).length).toBe(1);
42
- expect(dialog.find(DialogTitle_1.default).text()).toBe(props.title);
43
- expect(dialog.find(DialogContent_1.default).length).toBe(1);
44
- expect(dialog.find(DialogContent_1.default).text()).toBe(props.content);
45
- var dialogActions = dialog.find(DialogActions_1.default);
46
- expect(dialogActions.length).toBe(1);
72
+ var setUp = function (props) {
73
+ if (props === void 0) { props = defaultProps; }
74
+ var user = user_event_1.default.setup();
75
+ return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, __assign({}, props))));
76
+ };
77
+ afterEach(function () {
78
+ jest.clearAllMocks();
47
79
  });
48
- it('should render action buttons', function () {
49
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, __assign({}, props)));
50
- var buttons = component.find(DialogActions_1.default).find(Button_1.default);
51
- expect(buttons.length).toBe(3);
52
- expect(buttons.at(0).text()).toBe(props.cancelCaption);
53
- expect(buttons.at(0).prop('onClick')).toBe(props.onCancel);
54
- expect(buttons.at(1).text()).toBe(props.discardCaption);
55
- expect(buttons.at(1).prop('onClick')).toBe(props.onDiscard);
56
- expect(buttons.at(2).text()).toBe(props.saveCaption);
57
- expect(buttons.at(2).prop('onClick')).toBe(props.onSave);
80
+ it('should render main parts', function () {
81
+ setUp();
82
+ expect(react_2.screen.queryByText(defaultProps.title)).toBeInTheDocument();
83
+ expect(react_2.screen.queryByText(defaultProps.content)).toBeInTheDocument();
84
+ expect(react_2.screen.queryByRole('button', { name: defaultProps.cancelCaption })).toBeInTheDocument();
85
+ expect(react_2.screen.queryByRole('button', { name: defaultProps.discardCaption })).toBeInTheDocument();
86
+ expect(react_2.screen.queryByRole('button', { name: defaultProps.saveCaption })).toBeInTheDocument();
58
87
  });
88
+ it('should call handler for action buttons correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
89
+ var user;
90
+ return __generator(this, function (_a) {
91
+ switch (_a.label) {
92
+ case 0:
93
+ user = setUp().user;
94
+ return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: defaultProps.cancelCaption }))];
95
+ case 1:
96
+ _a.sent();
97
+ expect(onCancel).toHaveBeenCalled();
98
+ return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: defaultProps.discardCaption }))];
99
+ case 2:
100
+ _a.sent();
101
+ expect(onDiscard).toHaveBeenCalled();
102
+ return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: defaultProps.saveCaption }))];
103
+ case 3:
104
+ _a.sent();
105
+ expect(onSave).toHaveBeenCalled();
106
+ return [2 /*return*/];
107
+ }
108
+ });
109
+ }); });
59
110
  it('should disable Save buttons', function () {
60
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, __assign({}, props, { disabledSave: true })));
61
- var buttons = component.find(DialogActions_1.default).find(Button_1.default);
62
- expect(buttons.length).toBe(3);
63
- expect(buttons.at(2).text()).toBe(props.saveCaption);
64
- expect(buttons.at(2).prop('onClick')).toBe(props.onSave);
65
- expect(buttons.at(2).prop('disabled')).toBe(true);
111
+ setUp(__assign(__assign({}, defaultProps), { disabledSave: true }));
112
+ expect(react_2.screen.getByRole('button', { name: defaultProps.saveCaption })).toBeDisabled();
66
113
  });
67
114
  it('should no show button if action is not set', function () {
68
- var newProps = {
69
- open: true,
70
- title: '123',
71
- content: 'content',
72
- onSave: jest.fn(),
73
- saveCaption: 'save caption'
74
- };
75
- var component = (0, enzyme_1.shallow)(react_1.default.createElement(ConfirmationDialog_1.ConfirmationDialog, __assign({}, newProps)));
76
- var buttons = component.find(DialogActions_1.default).find(Button_1.default);
77
- expect(buttons.length).toBe(1);
78
- expect(buttons.text()).toBe(newProps.saveCaption);
79
- expect(buttons.prop('onClick')).toBe(newProps.onSave);
115
+ setUp(__assign(__assign({}, defaultProps), { onDiscard: undefined, onCancel: undefined }));
116
+ expect(react_2.screen.getByRole('button')).toHaveTextContent(defaultProps.saveCaption);
80
117
  });
81
118
  });