cozy-sharing 6.0.3 → 6.0.5
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/CHANGELOG.md +23 -0
- package/dist/SharingBanner/hooks/useSharingInfos.js +35 -37
- package/dist/SharingBanner/hooks/useSharingInfos.spec.js +40 -44
- package/dist/SharingProvider.js +351 -375
- package/dist/SharingProvider.spec.js +29 -33
- package/dist/components/CozyPassFingerprintDialogContent.spec.js +14 -16
- package/dist/components/Recipient/LinkRecipientPermissions.js +25 -27
- package/dist/components/Recipient/OwnerRecipient.js +22 -0
- package/dist/components/Recipient/OwnerRecipientDefault.js +20 -0
- package/dist/components/Recipient/Recipient.spec.js +39 -43
- package/dist/components/Recipient/RecipientPermissions.js +20 -22
- package/dist/components/Recipient/RecipientStatus.js +1 -1
- package/dist/components/ShareButton.js +0 -2
- package/dist/components/ShareByEmail.js +53 -55
- package/dist/components/ShareByEmail.spec.js +50 -52
- package/dist/components/ShareByLink.js +73 -79
- package/dist/components/ShareDialogCozyToCozy.spec.js +250 -269
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +33 -35
- package/dist/components/ShareDialogTwoStepsConfirmationContainer.spec.js +240 -266
- package/dist/components/SharedBadge.js +0 -2
- package/dist/components/WhoHasAccess.js +3 -13
- package/dist/components/badge.styl +7 -5
- package/dist/components/button.styl +11 -12
- package/dist/components/useFetchDocumentPath.js +16 -18
- package/dist/fetchNextPermissions.js +15 -17
- package/dist/getSharedDocument.js +13 -15
- package/dist/getSharedDocument.spec.js +10 -12
- package/dist/helpers/contacts.js +65 -69
- package/dist/helpers/contacts.spec.js +30 -32
- package/dist/helpers/files.js +26 -28
- package/dist/helpers/files.spec.js +54 -58
- package/dist/helpers/sharings.js +56 -60
- package/dist/helpers/synchronousJobQueue.js +19 -21
- package/dist/helpers/synchronousJobQueue.spec.js +39 -43
- package/dist/stylesheet.css +28 -820
- package/package.json +2 -2
- package/src/components/Recipient/OwnerRecipient.jsx +23 -0
- package/src/components/Recipient/OwnerRecipientDefault.jsx +29 -0
- package/src/components/Recipient/RecipientStatus.jsx +1 -1
- package/src/components/ShareDialogCozyToCozy.spec.jsx +19 -18
- package/src/components/WhoHasAccess.jsx +2 -20
- package/src/components/badge.styl +7 -5
- package/src/components/button.styl +11 -12
|
@@ -19,7 +19,14 @@ jest.mock('cozy-client', function () {
|
|
|
19
19
|
public_name: 'Alice'
|
|
20
20
|
}
|
|
21
21
|
}),
|
|
22
|
-
hasQueryBeenLoaded: jest.fn().mockReturnValue(true)
|
|
22
|
+
hasQueryBeenLoaded: jest.fn().mockReturnValue(true),
|
|
23
|
+
useClient: function useClient() {
|
|
24
|
+
return {
|
|
25
|
+
options: {
|
|
26
|
+
uri: mockRecipientAlice.instance
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
23
30
|
});
|
|
24
31
|
});
|
|
25
32
|
describe('ShareDialogCozyToCozy', function () {
|
|
@@ -47,49 +54,45 @@ describe('ShareDialogCozyToCozy', function () {
|
|
|
47
54
|
var _deferablePromise, promise, resolve, props, _setup2, getByText;
|
|
48
55
|
|
|
49
56
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
50
|
-
while (1) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
_deferablePromise = deferablePromise(), promise = _deferablePromise.promise, resolve = _deferablePromise.resolve;
|
|
60
|
+
props = _objectSpread(_objectSpread({}, getMockProps()), {}, {
|
|
61
|
+
twoStepsConfirmationMethods: {
|
|
62
|
+
getRecipientsToBeConfirmed: jest.fn(function () {
|
|
63
|
+
return promise;
|
|
64
|
+
}),
|
|
65
|
+
rejectRecipient: jest.fn()
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
_setup2 = setup(props), getByText = _setup2.getByText;
|
|
69
|
+
expect(getByText('Loading in progress')).toBeTruthy();
|
|
70
|
+
_context2.next = 6;
|
|
71
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
72
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
73
|
+
while (1) switch (_context.prev = _context.next) {
|
|
74
|
+
case 0:
|
|
75
|
+
resolve([{
|
|
76
|
+
name: mockRecipientBob.public_name,
|
|
77
|
+
id: 'SOME_ID',
|
|
78
|
+
email: mockRecipientBob.email
|
|
79
|
+
}]);
|
|
80
|
+
_context.next = 3;
|
|
57
81
|
return promise;
|
|
58
|
-
|
|
59
|
-
|
|
82
|
+
|
|
83
|
+
case 3:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context.stop();
|
|
60
86
|
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
resolve([{
|
|
71
|
-
name: recipientBob.public_name,
|
|
72
|
-
id: 'SOME_ID',
|
|
73
|
-
email: recipientBob.email
|
|
74
|
-
}]);
|
|
75
|
-
_context.next = 3;
|
|
76
|
-
return promise;
|
|
77
|
-
|
|
78
|
-
case 3:
|
|
79
|
-
case "end":
|
|
80
|
-
return _context.stop();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}, _callee);
|
|
84
|
-
})));
|
|
85
|
-
|
|
86
|
-
case 6:
|
|
87
|
-
expect(getByText('Verify')).toBeTruthy();
|
|
88
|
-
|
|
89
|
-
case 7:
|
|
90
|
-
case "end":
|
|
91
|
-
return _context2.stop();
|
|
92
|
-
}
|
|
87
|
+
}, _callee);
|
|
88
|
+
})));
|
|
89
|
+
|
|
90
|
+
case 6:
|
|
91
|
+
expect(getByText('Verify')).toBeTruthy();
|
|
92
|
+
|
|
93
|
+
case 7:
|
|
94
|
+
case "end":
|
|
95
|
+
return _context2.stop();
|
|
93
96
|
}
|
|
94
97
|
}, _callee2);
|
|
95
98
|
})));
|
|
@@ -97,49 +100,45 @@ describe('ShareDialogCozyToCozy', function () {
|
|
|
97
100
|
var _deferablePromise2, promise, resolve, props, _setup3, getByText, getAllByText;
|
|
98
101
|
|
|
99
102
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
100
|
-
while (1) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
104
|
+
case 0:
|
|
105
|
+
_deferablePromise2 = deferablePromise(), promise = _deferablePromise2.promise, resolve = _deferablePromise2.resolve;
|
|
106
|
+
props = _objectSpread(_objectSpread({}, getMockProps()), {}, {
|
|
107
|
+
twoStepsConfirmationMethods: {
|
|
108
|
+
getRecipientsToBeConfirmed: jest.fn(function () {
|
|
109
|
+
return promise;
|
|
110
|
+
}),
|
|
111
|
+
rejectRecipient: jest.fn()
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
_setup3 = setup(props), getByText = _setup3.getByText, getAllByText = _setup3.getAllByText;
|
|
115
|
+
_context4.next = 5;
|
|
116
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
117
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
118
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
resolve([{
|
|
121
|
+
name: mockRecipientBob.public_name,
|
|
122
|
+
id: 'SOME_ID',
|
|
123
|
+
email: mockRecipientBob.email
|
|
124
|
+
}]);
|
|
125
|
+
_context3.next = 3;
|
|
107
126
|
return promise;
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
|
|
128
|
+
case 3:
|
|
129
|
+
case "end":
|
|
130
|
+
return _context3.stop();
|
|
110
131
|
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
id: 'SOME_ID',
|
|
122
|
-
email: recipientBob.email
|
|
123
|
-
}]);
|
|
124
|
-
_context3.next = 3;
|
|
125
|
-
return promise;
|
|
126
|
-
|
|
127
|
-
case 3:
|
|
128
|
-
case "end":
|
|
129
|
-
return _context3.stop();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}, _callee3);
|
|
133
|
-
})));
|
|
134
|
-
|
|
135
|
-
case 5:
|
|
136
|
-
expect(getAllByText('Verify')).toHaveLength(1);
|
|
137
|
-
expect(getByText(/Some contacts are waiting for your confirmation/i)).toBeTruthy();
|
|
138
|
-
|
|
139
|
-
case 7:
|
|
140
|
-
case "end":
|
|
141
|
-
return _context4.stop();
|
|
142
|
-
}
|
|
132
|
+
}, _callee3);
|
|
133
|
+
})));
|
|
134
|
+
|
|
135
|
+
case 5:
|
|
136
|
+
expect(getAllByText('Verify')).toHaveLength(1);
|
|
137
|
+
expect(getByText(/Some contacts are waiting for your confirmation/i)).toBeTruthy();
|
|
138
|
+
|
|
139
|
+
case 7:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context4.stop();
|
|
143
142
|
}
|
|
144
143
|
}, _callee4);
|
|
145
144
|
})));
|
|
@@ -147,53 +146,49 @@ describe('ShareDialogCozyToCozy', function () {
|
|
|
147
146
|
var _deferablePromise3, promise, resolve, props, _setup4, getByText, getAllByText;
|
|
148
147
|
|
|
149
148
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
150
|
-
while (1) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
_deferablePromise3 = deferablePromise(), promise = _deferablePromise3.promise, resolve = _deferablePromise3.resolve;
|
|
152
|
+
props = _objectSpread(_objectSpread({}, getMockProps()), {}, {
|
|
153
|
+
twoStepsConfirmationMethods: {
|
|
154
|
+
getRecipientsToBeConfirmed: jest.fn(function () {
|
|
155
|
+
return promise;
|
|
156
|
+
}),
|
|
157
|
+
rejectRecipient: jest.fn()
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
_setup4 = setup(props), getByText = _setup4.getByText, getAllByText = _setup4.getAllByText;
|
|
161
|
+
_context6.next = 5;
|
|
162
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
163
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
164
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
165
|
+
case 0:
|
|
166
|
+
resolve([{
|
|
167
|
+
name: mockRecipientBob.public_name,
|
|
168
|
+
id: 'SOME_ID',
|
|
169
|
+
email: mockRecipientBob.email
|
|
170
|
+
}, {
|
|
171
|
+
name: mockRecipientClaude.public_name,
|
|
172
|
+
id: 'SOME_OTHER_ID',
|
|
173
|
+
email: mockRecipientClaude.email
|
|
174
|
+
}]);
|
|
175
|
+
_context5.next = 3;
|
|
157
176
|
return promise;
|
|
158
|
-
|
|
159
|
-
|
|
177
|
+
|
|
178
|
+
case 3:
|
|
179
|
+
case "end":
|
|
180
|
+
return _context5.stop();
|
|
160
181
|
}
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
id: 'SOME_ID',
|
|
172
|
-
email: recipientBob.email
|
|
173
|
-
}, {
|
|
174
|
-
name: recipientClaude.public_name,
|
|
175
|
-
id: 'SOME_OTHER_ID',
|
|
176
|
-
email: recipientClaude.email
|
|
177
|
-
}]);
|
|
178
|
-
_context5.next = 3;
|
|
179
|
-
return promise;
|
|
180
|
-
|
|
181
|
-
case 3:
|
|
182
|
-
case "end":
|
|
183
|
-
return _context5.stop();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}, _callee5);
|
|
187
|
-
})));
|
|
188
|
-
|
|
189
|
-
case 5:
|
|
190
|
-
expect(getAllByText('Verify')).toHaveLength(2);
|
|
191
|
-
expect(getByText(/2 contacts are waiting for your confirmation/i)).toBeTruthy();
|
|
192
|
-
|
|
193
|
-
case 7:
|
|
194
|
-
case "end":
|
|
195
|
-
return _context6.stop();
|
|
196
|
-
}
|
|
182
|
+
}, _callee5);
|
|
183
|
+
})));
|
|
184
|
+
|
|
185
|
+
case 5:
|
|
186
|
+
expect(getAllByText('Verify')).toHaveLength(2);
|
|
187
|
+
expect(getByText(/2 contacts are waiting for your confirmation/i)).toBeTruthy();
|
|
188
|
+
|
|
189
|
+
case 7:
|
|
190
|
+
case "end":
|
|
191
|
+
return _context6.stop();
|
|
197
192
|
}
|
|
198
193
|
}, _callee6);
|
|
199
194
|
})));
|
|
@@ -201,45 +196,41 @@ describe('ShareDialogCozyToCozy', function () {
|
|
|
201
196
|
var _deferablePromise4, promise, resolve, props, _setup5, queryByText;
|
|
202
197
|
|
|
203
198
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
204
|
-
while (1) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
199
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
200
|
+
case 0:
|
|
201
|
+
_deferablePromise4 = deferablePromise(), promise = _deferablePromise4.promise, resolve = _deferablePromise4.resolve;
|
|
202
|
+
props = _objectSpread(_objectSpread({}, getMockProps()), {}, {
|
|
203
|
+
twoStepsConfirmationMethods: {
|
|
204
|
+
getRecipientsToBeConfirmed: jest.fn(function () {
|
|
205
|
+
return promise;
|
|
206
|
+
}),
|
|
207
|
+
rejectRecipient: jest.fn()
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
_setup5 = setup(props), queryByText = _setup5.queryByText;
|
|
211
|
+
_context8.next = 5;
|
|
212
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
213
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
214
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
resolve([]);
|
|
217
|
+
_context7.next = 3;
|
|
211
218
|
return promise;
|
|
212
|
-
|
|
213
|
-
|
|
219
|
+
|
|
220
|
+
case 3:
|
|
221
|
+
case "end":
|
|
222
|
+
return _context7.stop();
|
|
214
223
|
}
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return promise;
|
|
226
|
-
|
|
227
|
-
case 3:
|
|
228
|
-
case "end":
|
|
229
|
-
return _context7.stop();
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}, _callee7);
|
|
233
|
-
})));
|
|
234
|
-
|
|
235
|
-
case 5:
|
|
236
|
-
expect(queryByText('Verify')).not.toBeInTheDocument();
|
|
237
|
-
expect(queryByText(/waiting for your confirmation/i)).not.toBeInTheDocument();
|
|
238
|
-
|
|
239
|
-
case 7:
|
|
240
|
-
case "end":
|
|
241
|
-
return _context8.stop();
|
|
242
|
-
}
|
|
224
|
+
}, _callee7);
|
|
225
|
+
})));
|
|
226
|
+
|
|
227
|
+
case 5:
|
|
228
|
+
expect(queryByText('Verify')).not.toBeInTheDocument();
|
|
229
|
+
expect(queryByText(/waiting for your confirmation/i)).not.toBeInTheDocument();
|
|
230
|
+
|
|
231
|
+
case 7:
|
|
232
|
+
case "end":
|
|
233
|
+
return _context8.stop();
|
|
243
234
|
}
|
|
244
235
|
}, _callee8);
|
|
245
236
|
})));
|
|
@@ -247,113 +238,103 @@ describe('ShareDialogCozyToCozy', function () {
|
|
|
247
238
|
var _deferablePromise5, promise, resolve, rejectRecipient, props, _setup6, getByText, verifyButton, rejectButton, confirmRejectButton;
|
|
248
239
|
|
|
249
240
|
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
250
|
-
while (1) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
241
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
242
|
+
case 0:
|
|
243
|
+
_deferablePromise5 = deferablePromise(), promise = _deferablePromise5.promise, resolve = _deferablePromise5.resolve;
|
|
244
|
+
rejectRecipient = jest.fn(function () {
|
|
245
|
+
return Promise.resolve();
|
|
246
|
+
});
|
|
247
|
+
props = _objectSpread(_objectSpread({}, getMockProps()), {}, {
|
|
248
|
+
twoStepsConfirmationMethods: {
|
|
249
|
+
getRecipientsToBeConfirmed: jest.fn(function () {
|
|
250
|
+
return promise;
|
|
251
|
+
}),
|
|
252
|
+
rejectRecipient: rejectRecipient,
|
|
253
|
+
recipientConfirmationDialogContent: CozyPassFingerprintDialogContent
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
_setup6 = setup(props), getByText = _setup6.getByText;
|
|
257
|
+
_context13.next = 6;
|
|
258
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
259
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
260
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
261
|
+
case 0:
|
|
262
|
+
resolve([{
|
|
263
|
+
name: mockRecipientBob.public_name,
|
|
264
|
+
id: 'SOME_ID',
|
|
265
|
+
email: mockRecipientBob.email,
|
|
266
|
+
fingerprintPhrase: 'SOME_FINGERPRINT_PHRASE'
|
|
267
|
+
}]);
|
|
268
|
+
_context9.next = 3;
|
|
260
269
|
return promise;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
270
|
+
|
|
271
|
+
case 3:
|
|
272
|
+
case "end":
|
|
273
|
+
return _context9.stop();
|
|
264
274
|
}
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}, _callee11);
|
|
324
|
-
})));
|
|
325
|
-
|
|
326
|
-
case 12:
|
|
327
|
-
expect(getByText("Do you really want to reject contact ".concat(recipientBob.public_name, " (").concat(recipientBob.email, ")?"))).toBeTruthy();
|
|
328
|
-
confirmRejectButton = getByText('Reject');
|
|
329
|
-
_context13.next = 16;
|
|
330
|
-
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
331
|
-
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
332
|
-
while (1) {
|
|
333
|
-
switch (_context12.prev = _context12.next) {
|
|
334
|
-
case 0:
|
|
335
|
-
return _context12.abrupt("return", fireEvent.click(confirmRejectButton));
|
|
336
|
-
|
|
337
|
-
case 1:
|
|
338
|
-
case "end":
|
|
339
|
-
return _context12.stop();
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}, _callee12);
|
|
343
|
-
})));
|
|
344
|
-
|
|
345
|
-
case 16:
|
|
346
|
-
expect(rejectRecipient).toBeCalled();
|
|
347
|
-
|
|
348
|
-
case 17:
|
|
349
|
-
case "end":
|
|
350
|
-
return _context13.stop();
|
|
351
|
-
}
|
|
275
|
+
}, _callee9);
|
|
276
|
+
})));
|
|
277
|
+
|
|
278
|
+
case 6:
|
|
279
|
+
verifyButton = getByText('Verify');
|
|
280
|
+
_context13.next = 9;
|
|
281
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
282
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
283
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
284
|
+
case 0:
|
|
285
|
+
return _context10.abrupt("return", fireEvent.click(verifyButton));
|
|
286
|
+
|
|
287
|
+
case 1:
|
|
288
|
+
case "end":
|
|
289
|
+
return _context10.stop();
|
|
290
|
+
}
|
|
291
|
+
}, _callee10);
|
|
292
|
+
})));
|
|
293
|
+
|
|
294
|
+
case 9:
|
|
295
|
+
rejectButton = getByText('Reject');
|
|
296
|
+
_context13.next = 12;
|
|
297
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
298
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
299
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
300
|
+
case 0:
|
|
301
|
+
return _context11.abrupt("return", fireEvent.click(rejectButton));
|
|
302
|
+
|
|
303
|
+
case 1:
|
|
304
|
+
case "end":
|
|
305
|
+
return _context11.stop();
|
|
306
|
+
}
|
|
307
|
+
}, _callee11);
|
|
308
|
+
})));
|
|
309
|
+
|
|
310
|
+
case 12:
|
|
311
|
+
expect(getByText("Do you really want to reject contact ".concat(mockRecipientBob.public_name, " (").concat(mockRecipientBob.email, ")?"))).toBeTruthy();
|
|
312
|
+
confirmRejectButton = getByText('Reject');
|
|
313
|
+
_context13.next = 16;
|
|
314
|
+
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
315
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
316
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
317
|
+
case 0:
|
|
318
|
+
return _context12.abrupt("return", fireEvent.click(confirmRejectButton));
|
|
319
|
+
|
|
320
|
+
case 1:
|
|
321
|
+
case "end":
|
|
322
|
+
return _context12.stop();
|
|
323
|
+
}
|
|
324
|
+
}, _callee12);
|
|
325
|
+
})));
|
|
326
|
+
|
|
327
|
+
case 16:
|
|
328
|
+
expect(rejectRecipient).toBeCalled();
|
|
329
|
+
|
|
330
|
+
case 17:
|
|
331
|
+
case "end":
|
|
332
|
+
return _context13.stop();
|
|
352
333
|
}
|
|
353
334
|
}, _callee13);
|
|
354
335
|
})));
|
|
355
336
|
});
|
|
356
|
-
var
|
|
337
|
+
var mockRecipientAlice = {
|
|
357
338
|
status: 'owner',
|
|
358
339
|
public_name: 'Alice',
|
|
359
340
|
email: 'me@alice.cozy.localhost',
|
|
@@ -363,7 +344,7 @@ var recipientAlice = {
|
|
|
363
344
|
index: 0,
|
|
364
345
|
avatarPath: '/sharings/SOME_SHARING_ID/recipients/0/avatar'
|
|
365
346
|
};
|
|
366
|
-
var
|
|
347
|
+
var mockRecipientBob = {
|
|
367
348
|
status: 'ready',
|
|
368
349
|
public_name: 'Claude',
|
|
369
350
|
email: 'me@claude.cozy.localhost',
|
|
@@ -373,7 +354,7 @@ var recipientBob = {
|
|
|
373
354
|
index: 1,
|
|
374
355
|
avatarPath: '/sharings/SOME_SHARING_ID/recipients/1/avatar'
|
|
375
356
|
};
|
|
376
|
-
var
|
|
357
|
+
var mockRecipientClaude = {
|
|
377
358
|
status: 'ready',
|
|
378
359
|
public_name: 'Bob',
|
|
379
360
|
email: 'me@bob.cozy.localhost',
|
|
@@ -472,7 +453,7 @@ var getMockProps = function getMockProps() {
|
|
|
472
453
|
isOwner: true,
|
|
473
454
|
link: null,
|
|
474
455
|
permissions: [],
|
|
475
|
-
recipients: [
|
|
456
|
+
recipients: [mockRecipientAlice, mockRecipientBob, mockRecipientClaude, {
|
|
476
457
|
status: 'pending',
|
|
477
458
|
email: 'me@ben.cozy.localhost',
|
|
478
459
|
type: 'two-way',
|
|
@@ -153,42 +153,40 @@ var ShareDialogTwoStepsConfirmationContainer = function ShareDialogTwoStepsConfi
|
|
|
153
153
|
var getRecipientsToBeConfirmed = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
154
154
|
var result;
|
|
155
155
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
156
|
-
while (1) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
_context.next = 15;
|
|
161
|
-
break;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
setStatus('loading');
|
|
165
|
-
_context.prev = 2;
|
|
166
|
-
_context.next = 5;
|
|
167
|
-
return twoStepsConfirmationMethods.getRecipientsToBeConfirmed();
|
|
168
|
-
|
|
169
|
-
case 5:
|
|
170
|
-
result = _context.sent;
|
|
171
|
-
setRecipientsToBeConfirmed(result);
|
|
172
|
-
setStatus('sharing');
|
|
173
|
-
_context.next = 13;
|
|
156
|
+
while (1) switch (_context.prev = _context.next) {
|
|
157
|
+
case 0:
|
|
158
|
+
if (!shouldGetRecipientsToBeConfirmed) {
|
|
159
|
+
_context.next = 15;
|
|
174
160
|
break;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
setStatus('loading');
|
|
164
|
+
_context.prev = 2;
|
|
165
|
+
_context.next = 5;
|
|
166
|
+
return twoStepsConfirmationMethods.getRecipientsToBeConfirmed();
|
|
167
|
+
|
|
168
|
+
case 5:
|
|
169
|
+
result = _context.sent;
|
|
170
|
+
setRecipientsToBeConfirmed(result);
|
|
171
|
+
setStatus('sharing');
|
|
172
|
+
_context.next = 13;
|
|
173
|
+
break;
|
|
174
|
+
|
|
175
|
+
case 10:
|
|
176
|
+
_context.prev = 10;
|
|
177
|
+
_context.t0 = _context["catch"](2);
|
|
178
|
+
setStatus('error');
|
|
179
|
+
|
|
180
|
+
case 13:
|
|
181
|
+
_context.next = 16;
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
case 15:
|
|
185
|
+
setStatus('sharing');
|
|
186
|
+
|
|
187
|
+
case 16:
|
|
188
|
+
case "end":
|
|
189
|
+
return _context.stop();
|
|
192
190
|
}
|
|
193
191
|
}, _callee, null, [[2, 10]]);
|
|
194
192
|
})), [shouldGetRecipientsToBeConfirmed, twoStepsConfirmationMethods, setRecipientsToBeConfirmed, setStatus]);
|