@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,6 +10,42 @@ 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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
50
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
51
|
if (ar || !(i in from)) {
|
|
@@ -24,113 +60,148 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
60
|
};
|
|
25
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
62
|
var react_1 = __importDefault(require("react"));
|
|
27
|
-
var enzyme_1 = require("enzyme");
|
|
28
|
-
var test_utils_1 = require("react-dom/test-utils");
|
|
29
|
-
var Checkbox_1 = __importDefault(require("@mui/material/Checkbox"));
|
|
30
|
-
var MenuItem_1 = __importDefault(require("@mui/material/MenuItem"));
|
|
31
|
-
var SelectionPopup_1 = require("../../../SelectionPopup");
|
|
32
63
|
var ColumnsSettingsPopup_1 = require("./ColumnsSettingsPopup");
|
|
33
|
-
var AttributeListItem_1 = require("../../../AttributeListItem");
|
|
34
64
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
65
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
66
|
+
var react_2 = require("@testing-library/react");
|
|
67
|
+
describe('ColumnsSettingsPopup tests', function () {
|
|
68
|
+
var columnsData = [
|
|
69
|
+
{
|
|
70
|
+
id: '1',
|
|
71
|
+
label: 'nest',
|
|
72
|
+
dataTypeDefinition: {
|
|
73
|
+
type: mdm_sdk_1.DataTypes.TYPE_NESTED
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: '1.2',
|
|
78
|
+
label: 'nested.number',
|
|
79
|
+
dataTypeDefinition: {
|
|
80
|
+
type: mdm_sdk_1.DataTypes.TYPE_NUMBER
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: '3',
|
|
85
|
+
label: 'date',
|
|
86
|
+
dataTypeDefinition: {
|
|
87
|
+
type: mdm_sdk_1.DataTypes.TYPE_DATE
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: '11',
|
|
92
|
+
label: 'Just simple with id starts as nested id',
|
|
93
|
+
dataTypeDefinition: {
|
|
94
|
+
type: mdm_sdk_1.DataTypes.TYPE_STRING
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
var onColumnClick = jest.fn();
|
|
99
|
+
var onClose = jest.fn();
|
|
100
|
+
var defaultProps = {
|
|
101
|
+
columnsData: columnsData,
|
|
102
|
+
selectedColumns: [],
|
|
103
|
+
onColumnClick: onColumnClick,
|
|
104
|
+
onClose: onClose,
|
|
105
|
+
anchorEl: document.body
|
|
106
|
+
};
|
|
107
|
+
var setUp = function (props) {
|
|
108
|
+
if (props === void 0) { props = defaultProps; }
|
|
109
|
+
var user = user_event_1.default.setup();
|
|
110
|
+
return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(ColumnsSettingsPopup_1.ColumnsSettingsPopup, __assign({}, props))));
|
|
111
|
+
};
|
|
112
|
+
afterEach(function () {
|
|
39
113
|
jest.clearAllMocks();
|
|
40
114
|
});
|
|
41
115
|
describe('plain columns data behavior', function () {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
label
|
|
46
|
-
|
|
47
|
-
|
|
116
|
+
it('should open columns popup on if anchorEl exist and call on close on press tab', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
|
+
var user;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0:
|
|
121
|
+
user = setUp().user;
|
|
122
|
+
expect(react_2.screen.getAllByRole('menuitem')).toHaveLength(columnsData.length);
|
|
123
|
+
expect(onClose).not.toHaveBeenCalled();
|
|
124
|
+
return [4 /*yield*/, user.keyboard('{Tab}')];
|
|
125
|
+
case 1:
|
|
126
|
+
_a.sent();
|
|
127
|
+
expect(onClose).toHaveBeenCalled();
|
|
128
|
+
return [2 /*return*/];
|
|
48
129
|
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
130
|
+
});
|
|
131
|
+
}); });
|
|
132
|
+
it('should call props.onColumnClick correctly on column click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
133
|
+
var user;
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
136
|
+
case 0:
|
|
137
|
+
user = setUp().user;
|
|
138
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('menuitem', { name: columnsData[2].label }))];
|
|
139
|
+
case 1:
|
|
140
|
+
_a.sent();
|
|
141
|
+
expect(onColumnClick.mock.calls[0][0]).toMatchObject({ id: columnsData[2].id });
|
|
142
|
+
return [2 /*return*/];
|
|
62
143
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
144
|
+
});
|
|
145
|
+
}); });
|
|
146
|
+
it('should call props.onColumnClick correctly on parent column click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
+
var user;
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
switch (_a.label) {
|
|
150
|
+
case 0:
|
|
151
|
+
user = setUp().user;
|
|
152
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('menuitem', { name: columnsData[0].label }))];
|
|
153
|
+
case 1:
|
|
154
|
+
_a.sent();
|
|
155
|
+
expect(onColumnClick.mock.calls[0][0]).toMatchObject({ id: columnsData[0].id });
|
|
156
|
+
expect(onClose).not.toHaveBeenCalled();
|
|
157
|
+
return [2 /*return*/];
|
|
69
158
|
}
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
var props = {
|
|
73
|
-
columnsData: columnsData,
|
|
74
|
-
selectedColumns: [],
|
|
75
|
-
onColumnClick: jest.fn(),
|
|
76
|
-
onClose: jest.fn(),
|
|
77
|
-
anchorEl: {}
|
|
78
|
-
};
|
|
79
|
-
it('should open columns popup on button click and close on click away', function () {
|
|
80
|
-
var wrapper = (0, enzyme_1.mount)(react_1.default.createElement(ColumnsSettingsPopup_1.ColumnsSettingsPopup, __assign({}, props)));
|
|
81
|
-
var columnsPopup = getColumnsPopup(wrapper);
|
|
82
|
-
expect(columnsPopup.prop('open')).toBe(true);
|
|
83
|
-
(0, test_utils_1.act)(function () {
|
|
84
|
-
columnsPopup.prop('onClose')();
|
|
85
159
|
});
|
|
86
|
-
|
|
160
|
+
}); });
|
|
161
|
+
it('should show selected icon for parent node if all chidlren selected', function () {
|
|
162
|
+
setUp(__assign(__assign({}, defaultProps), { selectedColumns: ['1.2'] }));
|
|
163
|
+
expect((0, react_2.within)(react_2.screen.getByRole('menuitem', { name: columnsData[0].label })).getByRole('checkbox')).toBeChecked();
|
|
87
164
|
});
|
|
88
|
-
it('should call props.onColumnClick correctly on column click', function () {
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
});
|
|
102
|
-
it('should call props.onColumnClick correctly on parent column click and call on close with hidden checkboxes', function () {
|
|
103
|
-
var wrapper = (0, enzyme_1.mount)(react_1.default.createElement(ColumnsSettingsPopup_1.ColumnsSettingsPopup, __assign({ hideCheckBox: true }, props)));
|
|
104
|
-
expect(wrapper.find(AttributeListItem_1.AttributeListItem).at(1).prop('hideCheckBox')).toBeTruthy();
|
|
105
|
-
expect(getColumnItems(wrapper).at(1).find(Checkbox_1.default)).toHaveLength(0);
|
|
106
|
-
getColumnItems(wrapper).at(1).find('div').at(0).simulate('click');
|
|
107
|
-
expect(props.onColumnClick.mock.calls[0][0]).toMatchObject({ id: columnsData[1].id });
|
|
108
|
-
expect(props.onClose).toHaveBeenCalled();
|
|
109
|
-
});
|
|
110
|
-
it('should filter columns by label on search input change', function () {
|
|
111
|
-
var wrapper = (0, enzyme_1.mount)(react_1.default.createElement(ColumnsSettingsPopup_1.ColumnsSettingsPopup, __assign({}, props)));
|
|
112
|
-
(0, test_utils_1.act)(function () {
|
|
113
|
-
getColumnsPopup(wrapper).prop('onSearch')('nested');
|
|
165
|
+
it('should call props.onColumnClick correctly on column click and call on close with hidden checkboxes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
166
|
+
var user;
|
|
167
|
+
return __generator(this, function (_a) {
|
|
168
|
+
switch (_a.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
user = setUp(__assign(__assign({}, defaultProps), { hideCheckBox: true })).user;
|
|
171
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('menuitem', { name: columnsData[1].label }))];
|
|
172
|
+
case 1:
|
|
173
|
+
_a.sent();
|
|
174
|
+
expect(onColumnClick.mock.calls[0][0]).toMatchObject({ id: columnsData[1].id });
|
|
175
|
+
expect(onClose).toHaveBeenCalled();
|
|
176
|
+
return [2 /*return*/];
|
|
177
|
+
}
|
|
114
178
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
179
|
+
}); });
|
|
180
|
+
it('should filter columns by label on search input change', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
181
|
+
var user, menuItems;
|
|
182
|
+
return __generator(this, function (_a) {
|
|
183
|
+
switch (_a.label) {
|
|
184
|
+
case 0:
|
|
185
|
+
user = setUp().user;
|
|
186
|
+
return [4 /*yield*/, user.type(react_2.screen.getByPlaceholderText('Search & add attributes'), 'nested')];
|
|
187
|
+
case 1:
|
|
188
|
+
_a.sent();
|
|
189
|
+
menuItems = react_2.screen.getAllByRole('menuitem');
|
|
190
|
+
expect(menuItems[0]).toHaveTextContent('nest');
|
|
191
|
+
expect(menuItems[1]).toHaveTextContent('nested.number');
|
|
192
|
+
expect(menuItems[2]).toHaveTextContent('Just simple with id starts as nested id');
|
|
193
|
+
return [2 /*return*/];
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}); });
|
|
122
197
|
it('should show only hideable columns', function () {
|
|
123
198
|
var nonHideableColumn = { id: 'NonHideable', hideable: false, label: '' };
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
expect(columnItems.length).toEqual(props.columnsData.length);
|
|
127
|
-
columnItems.forEach(function (item, index) {
|
|
128
|
-
expect(item.text()).toEqual(props.columnsData[index].label);
|
|
129
|
-
});
|
|
199
|
+
setUp(__assign(__assign({}, defaultProps), { columnsData: __spreadArray(__spreadArray([], columnsData, true), [nonHideableColumn], false) }));
|
|
200
|
+
expect(react_2.screen.getAllByRole('menuitem')).toHaveLength(columnsData.length);
|
|
130
201
|
});
|
|
131
202
|
});
|
|
132
203
|
describe('grouped columns data behavior', function () {
|
|
133
|
-
var
|
|
204
|
+
var groupedColumnsData = [
|
|
134
205
|
{
|
|
135
206
|
id: 'group1',
|
|
136
207
|
label: 'Group1',
|
|
@@ -179,48 +250,55 @@ describe('ColumnsSettingsPopup', function () {
|
|
|
179
250
|
]
|
|
180
251
|
}
|
|
181
252
|
];
|
|
182
|
-
var props = {
|
|
183
|
-
columnsData: columnsData,
|
|
184
|
-
selectedColumns: [],
|
|
185
|
-
onColumnClick: jest.fn(),
|
|
186
|
-
onClose: jest.fn(),
|
|
187
|
-
anchorEl: {}
|
|
188
|
-
};
|
|
189
|
-
beforeEach(function () {
|
|
190
|
-
jest.clearAllMocks();
|
|
191
|
-
});
|
|
192
253
|
it('should render items correctly', function () {
|
|
193
|
-
|
|
194
|
-
var columnItems =
|
|
254
|
+
setUp(__assign(__assign({}, defaultProps), { columnsData: groupedColumnsData }));
|
|
255
|
+
var columnItems = react_2.screen.getAllByRole('menuitem');
|
|
195
256
|
expect(columnItems).toHaveLength(7);
|
|
196
|
-
expect(columnItems
|
|
197
|
-
expect(columnItems
|
|
198
|
-
expect(columnItems
|
|
199
|
-
expect(columnItems
|
|
200
|
-
expect(columnItems
|
|
201
|
-
expect(columnItems
|
|
202
|
-
expect(columnItems
|
|
257
|
+
expect(columnItems[0]).toHaveTextContent('Group1');
|
|
258
|
+
expect(columnItems[1]).toHaveTextContent('nest');
|
|
259
|
+
expect(columnItems[2]).toHaveTextContent('nested.number');
|
|
260
|
+
expect(columnItems[3]).toHaveTextContent('column 4');
|
|
261
|
+
expect(columnItems[4]).toHaveTextContent('Group2');
|
|
262
|
+
expect(columnItems[5]).toHaveTextContent('date');
|
|
263
|
+
expect(columnItems[6]).toHaveTextContent('Just simple with id starts as nested id');
|
|
203
264
|
});
|
|
204
|
-
it('should call props.
|
|
205
|
-
var
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
265
|
+
it('should call props.onColumnClick correctly on group column click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
266
|
+
var user;
|
|
267
|
+
return __generator(this, function (_a) {
|
|
268
|
+
switch (_a.label) {
|
|
269
|
+
case 0:
|
|
270
|
+
user = setUp(__assign(__assign({}, defaultProps), { columnsData: groupedColumnsData })).user;
|
|
271
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('menuitem', { name: groupedColumnsData[0].columns[0].label }))];
|
|
272
|
+
case 1:
|
|
273
|
+
_a.sent();
|
|
274
|
+
expect(onColumnClick.mock.calls[0][0]).toMatchObject({ id: groupedColumnsData[0].columns[0].id });
|
|
275
|
+
expect(onClose).not.toHaveBeenCalled();
|
|
276
|
+
return [2 /*return*/];
|
|
277
|
+
}
|
|
215
278
|
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
expect(
|
|
220
|
-
expect(columnItems.at(1).text()).toBe('nest');
|
|
221
|
-
expect(columnItems.at(2).text()).toBe('nested.number');
|
|
222
|
-
expect(columnItems.at(3).text()).toBe('Group2');
|
|
223
|
-
expect(columnItems.at(4).text()).toBe('Just simple with id starts as nested id');
|
|
279
|
+
}); });
|
|
280
|
+
it('should show selected icon for parent node if all chidlren selected', function () {
|
|
281
|
+
setUp(__assign(__assign({}, defaultProps), { columnsData: groupedColumnsData, selectedColumns: ['1.2', '4'] }));
|
|
282
|
+
expect((0, react_2.within)(react_2.screen.getByRole('menuitem', { name: groupedColumnsData[0].columns[0].label })).getByRole('checkbox')).toBeChecked();
|
|
224
283
|
});
|
|
284
|
+
it('should filter columns by label on search input change', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
285
|
+
var user, menuItems;
|
|
286
|
+
return __generator(this, function (_a) {
|
|
287
|
+
switch (_a.label) {
|
|
288
|
+
case 0:
|
|
289
|
+
user = setUp(__assign(__assign({}, defaultProps), { columnsData: groupedColumnsData })).user;
|
|
290
|
+
return [4 /*yield*/, user.type(react_2.screen.getByPlaceholderText('Search & add attributes'), 'nested')];
|
|
291
|
+
case 1:
|
|
292
|
+
_a.sent();
|
|
293
|
+
menuItems = react_2.screen.getAllByRole('menuitem');
|
|
294
|
+
expect(menuItems[0]).toHaveTextContent('Group1');
|
|
295
|
+
expect(menuItems[1]).toHaveTextContent('nest');
|
|
296
|
+
expect(menuItems[2]).toHaveTextContent('nested.number');
|
|
297
|
+
expect(menuItems[3]).toHaveTextContent('Group2');
|
|
298
|
+
expect(menuItems[4]).toHaveTextContent('Just simple with id starts as nested id');
|
|
299
|
+
return [2 /*return*/];
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}); });
|
|
225
303
|
});
|
|
226
304
|
});
|