@reltio/components 1.4.1906 → 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.
- package/cjs/ActionsPanel/ActionsPanel.test.js +133 -49
- package/cjs/AttributeListItem/AttributeListItem.spec.js +147 -118
- package/cjs/AttributeSelector/AttributeSelector.specs.js +125 -193
- package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
- package/cjs/AttributesErrorsPanel/components/Error/Error.specs.js +96 -90
- package/cjs/AttributesErrorsPanel/store.test-data.d.ts +22 -0
- package/cjs/AttributesErrorsPanel/store.test-data.js +29 -0
- package/cjs/AttributesFilterSelector/AttributesFilterSelector.test.js +127 -105
- package/cjs/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
- package/cjs/AttributesValuesEditor/AttributesValuesEditor.test.js +92 -88
- package/cjs/AttributesView/AttributesView.test.js +67 -34
- package/cjs/AutoSizeList/AutoSizeList.test.js +81 -59
- package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +15 -31
- package/cjs/BarChart/BarChart.test.js +128 -65
- package/cjs/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
- package/cjs/BasicViewContent/BasicViewContent.test.js +7 -9
- package/cjs/BlobRenderer/BlobRenderer.test.js +28 -9
- package/cjs/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
- package/cjs/BubbleChart/BubbleChart.test.js +111 -87
- package/cjs/CloudChart/CloudChart.test.js +95 -36
- package/cjs/CollaborationItem/CollaborationItem.test.js +67 -30
- package/cjs/CollaborationItem/components/Comment/Comment.test.js +221 -189
- package/cjs/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -81
- package/cjs/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
- package/cjs/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
- package/cjs/CollapseButton/CollapseButton.test.js +74 -15
- package/cjs/CollapseRowButton/CollapseRowButton.test.js +82 -24
- package/cjs/ColorBar/ColorBar.test.js +13 -15
- package/cjs/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
- package/cjs/CommentsContainer/CommentsContainer.test.js +282 -211
- package/cjs/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +183 -122
- package/cjs/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
- package/cjs/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
- package/cjs/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
- package/cjs/ConnectionEditor/ConnectionEditor.test.js +299 -282
- package/esm/ActionsPanel/ActionsPanel.test.js +133 -49
- package/esm/AttributeListItem/AttributeListItem.spec.js +149 -97
- package/esm/AttributeSelector/AttributeSelector.specs.js +125 -193
- package/esm/AttributesErrorsPanel/AttributesErrorsPanel.specs.js +128 -71
- package/esm/AttributesErrorsPanel/components/Error/Error.specs.js +98 -72
- package/esm/AttributesErrorsPanel/store.test-data.d.ts +22 -0
- package/esm/AttributesErrorsPanel/store.test-data.js +26 -0
- package/esm/AttributesFilterSelector/AttributesFilterSelector.test.js +129 -84
- package/esm/AttributesFiltersButton/AttributesFiltersButton.test.js +218 -136
- package/esm/AttributesValuesEditor/AttributesValuesEditor.test.js +94 -67
- package/esm/AttributesView/AttributesView.test.js +67 -34
- package/esm/AutoSizeList/AutoSizeList.test.js +81 -59
- package/esm/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.js → AvatarWithFallback/AvatarWithFallback.test.js} +16 -32
- package/esm/BarChart/BarChart.test.js +128 -65
- package/esm/BasicAttributeSelector/BasicAttributeSelector.spec.js +27 -10
- package/esm/BasicViewContent/BasicViewContent.test.js +7 -9
- package/esm/BlobRenderer/BlobRenderer.test.js +28 -9
- package/esm/BooleanRadioEditor/BooleanRadioEditor.test.js +89 -35
- package/esm/BubbleChart/BubbleChart.test.js +111 -87
- package/esm/CloudChart/CloudChart.test.js +95 -36
- package/esm/CollaborationItem/CollaborationItem.test.js +67 -30
- package/esm/CollaborationItem/components/Comment/Comment.test.js +221 -189
- package/esm/CollaborationItem/components/CommentContent/CommentContent.test.js +46 -58
- package/esm/CollaborationItem/components/RepliedComment/RepliedComment.test.js +194 -163
- package/esm/CollaborationItem/components/SendMessageArea/SendMessageArea.test.js +307 -266
- package/esm/CollapseButton/CollapseButton.test.js +74 -15
- package/esm/CollapseRowButton/CollapseRowButton.test.js +82 -24
- package/esm/ColorBar/ColorBar.test.js +13 -15
- package/esm/ColumnsSettings/components/ColumnsSettingsPopup/ColumnsSettingsPopup.spec.js +207 -129
- package/esm/CommentsContainer/CommentsContainer.test.js +282 -211
- package/esm/CommentsContainer/components/CollaborationPopup/CollaborationPopup.test.js +182 -101
- package/esm/ConfigureColumnsPopup/ConfigureColumnsPopup.test.js +42 -41
- package/esm/ConfirmDeleteDialog/ConfirmDeleteDialog.test.js +77 -28
- package/esm/ConfirmationDialog/ConfirmationDialog.test.js +85 -48
- package/esm/ConnectionEditor/ConnectionEditor.test.js +300 -283
- package/package.json +1 -1
- package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -100
- package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
- package/cjs/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -46
- package/cjs/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
- package/cjs/AvatarWithFallback/AvatarWithFallback.specs.js +0 -27
- package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
- package/cjs/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -27
- package/cjs/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
- package/cjs/CollaborationItem/components/Avatar/Avatar.test.js +0 -15
- package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
- package/cjs/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -80
- package/esm/ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts +0 -1
- package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts +0 -1
- package/esm/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.js +0 -95
- package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.d.ts +0 -1
- package/esm/AttributesFiltersButton/components/ActionButtons/ActionButtons.test.js +0 -41
- package/esm/AvatarWithFallback/AvatarWithFallback.specs.d.ts +0 -1
- package/esm/AvatarWithFallback/AvatarWithFallback.specs.js +0 -22
- package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.d.ts +0 -1
- package/esm/BooleanRadioEditor/components/BooleanEditor/BooleanEditor.test.js +0 -22
- package/esm/CollaborationItem/components/Avatar/Avatar.test.d.ts +0 -1
- package/esm/CollaborationItem/components/Avatar/Avatar.test.js +0 -10
- package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.d.ts +0 -1
- package/esm/CollaborationItem/components/TextFieldWithMentions/TextFieldWithMentions.test.js +0 -55
- /package/cjs/{ActionsPanel/components/MenuItemRenderer/MenuItemRenderer.spec.d.ts → AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
- /package/{cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.specs.d.ts → esm/AvatarWithFallback/AvatarWithFallback.test.d.ts} +0 -0
|
@@ -10,148 +10,209 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 };
|
|
18
47
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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;
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
35
51
|
};
|
|
36
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
var react_1 =
|
|
38
|
-
var
|
|
53
|
+
var react_1 = __importDefault(require("react"));
|
|
54
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
55
|
+
var react_2 = require("@testing-library/react");
|
|
39
56
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
40
|
-
var PopupWithArrow_1 = require("../../../PopupWithArrow");
|
|
41
|
-
var CollaborationItem_1 = require("../../../CollaborationItem");
|
|
42
57
|
var CollaborationPopup_1 = require("./CollaborationPopup");
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
modifiedTime: 1620280061505,
|
|
52
|
-
deleted: false,
|
|
53
|
-
visibility: 'public',
|
|
54
|
-
status: 'resolved',
|
|
55
|
-
objectId: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5',
|
|
56
|
-
objectType: mdm_sdk_1.CollaborationObjectTypes.ENTITY_ATTRIBUTE,
|
|
57
|
-
permanentLink: 'http://localhost:3000/ui/sokol/#p~com.reltio.plugins.entity.perspective.HCA_e~entities%2F13JKIKAz_ps~profile_cmt~00001lo',
|
|
58
|
-
content: 'comment',
|
|
59
|
-
namedUsers: [],
|
|
60
|
-
replies: [],
|
|
61
|
-
relatedObjectUris: ['entities/13JKIKAz']
|
|
62
|
-
};
|
|
63
|
-
if (hasReplies) {
|
|
64
|
-
comment.replies.push({
|
|
65
|
-
selfLink: 'https://cservice-dev.reltio.com/tst-01/sokol/comments/00001lo/replies/000007s',
|
|
66
|
-
replyId: '000007s',
|
|
58
|
+
var CollaborationContext_1 = require("../../../contexts/CollaborationContext");
|
|
59
|
+
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
60
|
+
describe('CollaborationPopup tests', function () {
|
|
61
|
+
var createComment = function (hasReplies) {
|
|
62
|
+
if (hasReplies === void 0) { hasReplies = false; }
|
|
63
|
+
var comment = {
|
|
64
|
+
selfLink: 'https://cservice-dev.reltio.com/tst-01/sokol/comments/00001lo',
|
|
65
|
+
commentId: '00001lo',
|
|
67
66
|
createdBy: 'vyacheslav.kovyazin',
|
|
68
|
-
createdTime:
|
|
67
|
+
createdTime: 1620280049022,
|
|
69
68
|
modifiedTime: 1620280061505,
|
|
70
69
|
deleted: false,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
visibility: 'public',
|
|
71
|
+
status: 'resolved',
|
|
72
|
+
objectId: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5',
|
|
73
|
+
objectType: mdm_sdk_1.CollaborationObjectTypes.ENTITY_ATTRIBUTE,
|
|
74
|
+
permanentLink: 'http://localhost:3000/ui/sokol/#p~com.reltio.plugins.entity.perspective.HCA_e~entities%2F13JKIKAz_ps~profile_cmt~00001lo',
|
|
75
|
+
content: 'comment',
|
|
76
|
+
namedUsers: [],
|
|
77
|
+
replies: [],
|
|
78
|
+
relatedObjectUris: ['entities/13JKIKAz']
|
|
79
|
+
};
|
|
80
|
+
if (hasReplies) {
|
|
81
|
+
comment.replies.push({
|
|
82
|
+
selfLink: 'https://cservice-dev.reltio.com/tst-01/sokol/comments/00001lo/replies/000007s',
|
|
83
|
+
replyId: '000007s',
|
|
84
|
+
createdBy: 'vyacheslav.kovyazin',
|
|
85
|
+
createdTime: 1620280061505,
|
|
86
|
+
modifiedTime: 1620280061505,
|
|
87
|
+
deleted: false,
|
|
88
|
+
action: 'none',
|
|
89
|
+
content: 'abc',
|
|
90
|
+
namedUsers: []
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return comment;
|
|
94
|
+
};
|
|
95
|
+
var createProps = function (comment) {
|
|
96
|
+
var onClose = jest.fn();
|
|
97
|
+
return {
|
|
98
|
+
comment: comment,
|
|
99
|
+
uri: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5',
|
|
100
|
+
relatedObjectUris: ['entities/13JKIKAz'],
|
|
101
|
+
objectType: mdm_sdk_1.CollaborationObjectTypes.ENTITY_ATTRIBUTE,
|
|
102
|
+
onClose: onClose,
|
|
103
|
+
anchorEl: document.body,
|
|
104
|
+
open: true
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
var entity = {
|
|
108
|
+
type: 'configuration/entityTypes/HCP',
|
|
109
|
+
uri: 'entities/02ZRRE9',
|
|
110
|
+
attributes: {
|
|
111
|
+
FirstName: [
|
|
112
|
+
{
|
|
113
|
+
type: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
114
|
+
ov: true,
|
|
115
|
+
value: 'nameValue',
|
|
116
|
+
uri: 'entities/02ZRRE9/attributes/FirstName/15p60Tel'
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var metadata = {
|
|
122
|
+
entityTypes: [
|
|
123
|
+
{
|
|
124
|
+
uri: 'configuration/entityTypes/HCP',
|
|
125
|
+
attributes: [
|
|
126
|
+
{
|
|
127
|
+
uri: 'configuration/entityTypes/HCP/attributes/FirstName',
|
|
128
|
+
type: 'String',
|
|
129
|
+
name: 'FirstName',
|
|
130
|
+
label: 'First Name',
|
|
131
|
+
access: ['READ', 'CREATE', 'UPDATE', 'INITIATE_CHANGE_REQUEST']
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
var actions = {
|
|
138
|
+
removeAttribute: function () { }
|
|
139
|
+
};
|
|
140
|
+
var mdmDefaultValues = {
|
|
141
|
+
user: {
|
|
142
|
+
username: 'test.testmail'
|
|
143
|
+
},
|
|
144
|
+
entity: entity,
|
|
145
|
+
metadata: metadata,
|
|
146
|
+
modifiedEntities: { 'entities/02ZRRE9': entity },
|
|
147
|
+
dependentLookups: { editors: {}, structure: {}, initedTypeUris: [] }
|
|
148
|
+
};
|
|
149
|
+
var defaultCollaborationContextValue = {
|
|
150
|
+
getCommentState: jest.fn().mockReturnValue({}),
|
|
151
|
+
resolveThread: jest.fn(),
|
|
152
|
+
sending: false,
|
|
153
|
+
loading: false
|
|
154
|
+
};
|
|
155
|
+
var setUp = function (_a) {
|
|
156
|
+
var props = _a.props, _b = _a.collaborationContextValue, collaborationContextValue = _b === void 0 ? defaultCollaborationContextValue : _b;
|
|
157
|
+
var Providers = function (_a) {
|
|
158
|
+
var children = _a.children;
|
|
159
|
+
return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: mdmDefaultValues, actions: actions },
|
|
160
|
+
react_1.default.createElement(CollaborationContext_1.CollaborationContext.Provider, { value: collaborationContextValue }, children)));
|
|
161
|
+
};
|
|
162
|
+
var user = user_event_1.default.setup();
|
|
163
|
+
return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(CollaborationPopup_1.CollaborationPopup, __assign({}, props)), { wrapper: Providers }));
|
|
88
164
|
};
|
|
89
|
-
};
|
|
90
|
-
var resolveThread = jest.fn();
|
|
91
|
-
var mockCollaborationContext = function (sending, loading) {
|
|
92
|
-
if (sending === void 0) { sending = false; }
|
|
93
|
-
if (loading === void 0) { loading = false; }
|
|
94
|
-
return jest.spyOn(react, 'useContext').mockImplementation(function () { return ({
|
|
95
|
-
sending: sending,
|
|
96
|
-
loading: loading,
|
|
97
|
-
resolveThread: resolveThread
|
|
98
|
-
}); });
|
|
99
|
-
};
|
|
100
|
-
describe('CollaborationPopup tests', function () {
|
|
101
|
-
afterEach(function () {
|
|
102
|
-
jest.resetAllMocks();
|
|
103
|
-
});
|
|
104
|
-
it('should render popup correctly', function () {
|
|
105
|
-
mockCollaborationContext();
|
|
106
|
-
var props = createProps(createComment());
|
|
107
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(CollaborationPopup_1.CollaborationPopup, __assign({}, props)));
|
|
108
|
-
var popup = component.find(PopupWithArrow_1.PopupWithArrow);
|
|
109
|
-
expect(popup).toHaveLength(1);
|
|
110
|
-
expect(popup.props()).toMatchObject({
|
|
111
|
-
open: true,
|
|
112
|
-
onClose: props.onClose,
|
|
113
|
-
anchorEl: props.anchorEl,
|
|
114
|
-
className: 'popper'
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
165
|
it('should render correctly if comment do not exists', function () {
|
|
118
|
-
mockCollaborationContext();
|
|
119
166
|
var props = createProps();
|
|
120
|
-
|
|
121
|
-
expect(
|
|
122
|
-
expect(
|
|
123
|
-
expect(component.find(CollaborationItem_1.CollaborationItem)).toHaveLength(1);
|
|
167
|
+
setUp({ props: props });
|
|
168
|
+
expect(document.querySelector('.counter')).not.toBeInTheDocument();
|
|
169
|
+
expect(react_2.screen.queryByRole('textbox')).toBeInTheDocument();
|
|
124
170
|
});
|
|
125
171
|
it('should render correctly if comment exists and loading is "false"', function () {
|
|
126
|
-
mockCollaborationContext();
|
|
127
172
|
var props = createProps(createComment());
|
|
128
|
-
|
|
129
|
-
expect(
|
|
130
|
-
expect(
|
|
131
|
-
expect(
|
|
173
|
+
setUp({ props: props });
|
|
174
|
+
expect(document.querySelector('.counter')).toHaveTextContent('1 item');
|
|
175
|
+
expect(react_2.screen.queryByRole('button', { name: '' })).toBeInTheDocument();
|
|
176
|
+
expect(react_2.screen.queryByRole('textbox')).toBeInTheDocument();
|
|
132
177
|
});
|
|
133
178
|
it('should render correctly if loading is "true"', function () {
|
|
134
|
-
mockCollaborationContext(false, true);
|
|
135
179
|
var props = createProps(createComment());
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
180
|
+
setUp({
|
|
181
|
+
props: props,
|
|
182
|
+
collaborationContextValue: __assign(__assign({}, defaultCollaborationContextValue), { loading: true })
|
|
183
|
+
});
|
|
184
|
+
expect(document.querySelector('.counter')).not.toBeInTheDocument();
|
|
185
|
+
expect(react_2.screen.queryByRole('button', { name: '' })).not.toBeInTheDocument();
|
|
186
|
+
expect(react_2.screen.queryByRole('textbox')).not.toBeInTheDocument();
|
|
140
187
|
});
|
|
141
188
|
it('should disable resolveButton if sending is "true"', function () {
|
|
142
|
-
mockCollaborationContext(true, false);
|
|
143
|
-
var props = createProps(createComment());
|
|
144
|
-
var component = (0, enzyme_1.shallow)(react_1.default.createElement(CollaborationPopup_1.CollaborationPopup, __assign({}, props)));
|
|
145
|
-
expect(component.find('.resolveButton').prop('disabled')).toBe(true);
|
|
146
|
-
});
|
|
147
|
-
it('handleResolve handler should work correctly', function () {
|
|
148
|
-
mockCollaborationContext();
|
|
149
189
|
var props = createProps(createComment());
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
commentId: '00001lo',
|
|
154
|
-
uri: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5'
|
|
190
|
+
setUp({
|
|
191
|
+
props: props,
|
|
192
|
+
collaborationContextValue: __assign(__assign({}, defaultCollaborationContextValue), { sending: true })
|
|
155
193
|
});
|
|
194
|
+
expect(react_2.screen.queryByRole('button', { name: '' })).toBeDisabled();
|
|
156
195
|
});
|
|
196
|
+
it('handleResolve handler should work correctly', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
197
|
+
var props, resolveThread, user;
|
|
198
|
+
return __generator(this, function (_a) {
|
|
199
|
+
switch (_a.label) {
|
|
200
|
+
case 0:
|
|
201
|
+
props = createProps(createComment());
|
|
202
|
+
resolveThread = jest.fn();
|
|
203
|
+
user = setUp({
|
|
204
|
+
props: props,
|
|
205
|
+
collaborationContextValue: __assign(__assign({}, defaultCollaborationContextValue), { resolveThread: resolveThread })
|
|
206
|
+
}).user;
|
|
207
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: '' }))];
|
|
208
|
+
case 1:
|
|
209
|
+
_a.sent();
|
|
210
|
+
expect(resolveThread).toHaveBeenCalledWith({
|
|
211
|
+
commentId: '00001lo',
|
|
212
|
+
uri: 'entities/13JKIKAz/attributes/Name/2mlWuqDq5'
|
|
213
|
+
});
|
|
214
|
+
return [2 /*return*/];
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}); });
|
|
157
218
|
});
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
17
|
var react_1 = __importDefault(require("react"));
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var AttributeListItem_1 = require("../AttributeListItem");
|
|
10
|
-
var Highlighter_1 = require("../Highlighter");
|
|
18
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
19
|
+
var react_2 = require("@testing-library/react");
|
|
11
20
|
var ConfigureColumnsPopup_1 = require("./ConfigureColumnsPopup");
|
|
12
21
|
describe('ConfigureColumnsPopup tests', function () {
|
|
22
|
+
var defaultProps = {
|
|
23
|
+
selected: [],
|
|
24
|
+
anchorEl: document.body,
|
|
25
|
+
open: true
|
|
26
|
+
};
|
|
27
|
+
var setUp = function (props) {
|
|
28
|
+
var user = user_event_1.default.setup();
|
|
29
|
+
return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(ConfigureColumnsPopup_1.ConfigureColumnsPopup, __assign({}, props))));
|
|
30
|
+
};
|
|
13
31
|
it('should render all components', function () {
|
|
14
32
|
var data = [
|
|
15
33
|
{
|
|
@@ -21,12 +39,10 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
21
39
|
label: 'item2'
|
|
22
40
|
}
|
|
23
41
|
];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
expect(
|
|
28
|
-
expect(selectionPopup.prop('title')).toBe('Show/hide columns');
|
|
29
|
-
expect(component.find(AttributeListItem_1.AttributeListItem)).toHaveLength(2);
|
|
42
|
+
setUp(__assign(__assign({}, defaultProps), { data: data }));
|
|
43
|
+
expect(react_2.screen.queryByRole('menuitem', { name: data[0].label })).toBeInTheDocument();
|
|
44
|
+
expect(react_2.screen.queryByRole('menuitem', { name: data[1].label })).toBeInTheDocument();
|
|
45
|
+
expect(react_2.screen.queryByText('Show/hide columns')).toBeInTheDocument();
|
|
30
46
|
});
|
|
31
47
|
it('should render nested items with their children', function () {
|
|
32
48
|
var data = [
|
|
@@ -53,15 +69,12 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
53
69
|
]
|
|
54
70
|
}
|
|
55
71
|
];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
expect(
|
|
61
|
-
expect(
|
|
62
|
-
expect(items.at(2).prop('level')).toBe(0);
|
|
63
|
-
expect(items.at(3).prop('level')).toBe(1);
|
|
64
|
-
expect(items.at(4).prop('level')).toBe(1);
|
|
72
|
+
setUp(__assign(__assign({}, defaultProps), { data: data }));
|
|
73
|
+
expect(react_2.screen.getByRole('menuitem', { name: data[0].label }).querySelector('.marginWrapper')).toHaveStyle({
|
|
74
|
+
'margin-left': '0px'
|
|
75
|
+
});
|
|
76
|
+
expect(react_2.screen.getByRole('menuitem', { name: data[2].children[0].label }).querySelector('.marginWrapper')).toHaveStyle({ 'margin-left': '20px' });
|
|
77
|
+
expect(react_2.screen.getByRole('menuitem', { name: data[2].children[1].label }).querySelector('.marginWrapper')).toHaveStyle({ 'margin-left': '20px' });
|
|
65
78
|
});
|
|
66
79
|
it('should show parent items for filtered subitems', function () {
|
|
67
80
|
var data = [
|
|
@@ -88,24 +101,14 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
88
101
|
]
|
|
89
102
|
}
|
|
90
103
|
];
|
|
91
|
-
var selected = [];
|
|
92
104
|
var filterText = 'subitem';
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
expect(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
expect(
|
|
100
|
-
expect(items.at(1).prop('labelInText')).toBe('Nested item');
|
|
101
|
-
expect(getLabel(1).find(Highlighter_1.Highlighter).prop('text')).toBe('Nested item');
|
|
102
|
-
expect(getLabel(1).find(Highlighter_1.Highlighter).prop('highlight')).toBe(filterText);
|
|
103
|
-
expect(items.at(2).prop('labelInText')).toBe('subitem3');
|
|
104
|
-
expect(getLabel(2).find(Highlighter_1.Highlighter).prop('text')).toBe('subitem3');
|
|
105
|
-
expect(getLabel(2).find(Highlighter_1.Highlighter).prop('highlight')).toBe(filterText);
|
|
106
|
-
expect(items.at(3).prop('labelInText')).toBe('subitem4');
|
|
107
|
-
expect(getLabel(3).find(Highlighter_1.Highlighter).prop('text')).toBe('subitem4');
|
|
108
|
-
expect(getLabel(3).find(Highlighter_1.Highlighter).prop('highlight')).toBe(filterText);
|
|
105
|
+
setUp(__assign(__assign({}, defaultProps), { filterText: filterText, data: data }));
|
|
106
|
+
var subItems = react_2.screen.getAllByText(filterText);
|
|
107
|
+
expect(subItems).toHaveLength(3);
|
|
108
|
+
subItems.forEach(function (subItem) {
|
|
109
|
+
expect(subItem).toHaveClass('highlight');
|
|
110
|
+
});
|
|
111
|
+
expect(react_2.screen.getByRole('menuitem', { name: 'Nested item' })).toBeInTheDocument();
|
|
109
112
|
});
|
|
110
113
|
it('should show parent items as checked for checked subitems', function () {
|
|
111
114
|
var data = [
|
|
@@ -137,10 +140,8 @@ describe('ConfigureColumnsPopup tests', function () {
|
|
|
137
140
|
id: '3.1'
|
|
138
141
|
}
|
|
139
142
|
];
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
expect(
|
|
143
|
-
expect(checkedItems.at(0).prop('labelInText')).toBe('Nested item');
|
|
144
|
-
expect(checkedItems.at(1).prop('labelInText')).toBe('subitem3');
|
|
143
|
+
setUp(__assign(__assign({}, defaultProps), { selected: selected, data: data }));
|
|
144
|
+
expect((0, react_2.within)(react_2.screen.getByRole('menuitem', { name: 'Nested item' })).getByRole('checkbox')).toBeChecked();
|
|
145
|
+
expect((0, react_2.within)(react_2.screen.getByRole('menuitem', { name: 'subitem3' })).getByRole('checkbox')).toBeChecked();
|
|
145
146
|
});
|
|
146
147
|
});
|
|
@@ -10,42 +10,91 @@ 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 DialogContentText_1 = __importDefault(require("@mui/material/DialogContentText"));
|
|
24
54
|
var ConfirmDeleteDialog_1 = require("./ConfirmDeleteDialog");
|
|
55
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
|
+
var react_2 = require("@testing-library/react");
|
|
25
57
|
describe('ConfirmDeleteDialog tests', function () {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
58
|
+
var setUp = function () {
|
|
59
|
+
var onClose = jest.fn();
|
|
60
|
+
var onConfirm = jest.fn();
|
|
61
|
+
var user = user_event_1.default.setup();
|
|
62
|
+
return __assign({ user: user, onClose: onClose, onConfirm: onConfirm }, (0, react_2.render)(react_1.default.createElement(ConfirmDeleteDialog_1.ConfirmDeleteDialog, { open: true, onClose: onClose, onConfirm: onConfirm })));
|
|
30
63
|
};
|
|
31
64
|
it('should render correctly', function () {
|
|
32
|
-
|
|
33
|
-
expect(
|
|
34
|
-
|
|
35
|
-
expect(
|
|
36
|
-
expect(buttons.length).toBe(2);
|
|
37
|
-
expect(buttons.at(0).text()).toBe('No');
|
|
38
|
-
expect(buttons.at(0).prop('onClick')).toBe(props.onClose);
|
|
39
|
-
expect(buttons.at(1).text()).toBe('Yes');
|
|
40
|
-
});
|
|
41
|
-
it('should call props.onConfirm and props.onClose when click "Yes" button', function () {
|
|
42
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ConfirmDeleteDialog_1.ConfirmDeleteDialog, __assign({}, props)));
|
|
43
|
-
expect(wrapper.find(Dialog_1.default).prop('open')).toBe(props.open);
|
|
44
|
-
wrapper
|
|
45
|
-
.find(Button_1.default)
|
|
46
|
-
.filterWhere(function (button) { return button.text() === 'Yes'; })
|
|
47
|
-
.simulate('click');
|
|
48
|
-
expect(props.onClose).toBeCalledTimes(1);
|
|
49
|
-
expect(props.onConfirm).toBeCalledTimes(1);
|
|
65
|
+
setUp();
|
|
66
|
+
expect(react_2.screen.queryByRole('button', { name: 'Yes' })).toBeInTheDocument();
|
|
67
|
+
expect(react_2.screen.queryByRole('button', { name: 'No' })).toBeInTheDocument();
|
|
68
|
+
expect(react_2.screen.queryByText('Are you sure you want to delete this?')).toBeInTheDocument();
|
|
50
69
|
});
|
|
70
|
+
it('should call props.onClose when click "No" button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
+
var _a, user, onConfirm, onClose;
|
|
72
|
+
return __generator(this, function (_b) {
|
|
73
|
+
switch (_b.label) {
|
|
74
|
+
case 0:
|
|
75
|
+
_a = setUp(), user = _a.user, onConfirm = _a.onConfirm, onClose = _a.onClose;
|
|
76
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'No' }))];
|
|
77
|
+
case 1:
|
|
78
|
+
_b.sent();
|
|
79
|
+
expect(onClose).toHaveBeenCalledTimes(1);
|
|
80
|
+
expect(onConfirm).not.toHaveBeenCalled();
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}); });
|
|
85
|
+
it('should call props.onConfirm and props.onClose when click "Yes" button', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
var _a, user, onConfirm, onClose;
|
|
87
|
+
return __generator(this, function (_b) {
|
|
88
|
+
switch (_b.label) {
|
|
89
|
+
case 0:
|
|
90
|
+
_a = setUp(), user = _a.user, onConfirm = _a.onConfirm, onClose = _a.onClose;
|
|
91
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Yes' }))];
|
|
92
|
+
case 1:
|
|
93
|
+
_b.sent();
|
|
94
|
+
expect(onClose).toHaveBeenCalledTimes(1);
|
|
95
|
+
expect(onConfirm).toHaveBeenCalledTimes(1);
|
|
96
|
+
return [2 /*return*/];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}); });
|
|
51
100
|
});
|