@digigov/ui 0.7.0 → 0.8.4
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 +27 -1
- package/api/APIErrors.js +1 -1
- package/api/fetchAPI.js +1 -1
- package/api/index.js +1 -1
- package/api/index.spec.js +112 -212
- package/api/useResourceQuery.js +1 -1
- package/api/utils.js +2 -2
- package/app/App.js +1 -1
- package/app/Header/HeaderLogo.js +1 -1
- package/app/Header/HeaderSection.js +1 -1
- package/app/Header/HeaderTitle.js +1 -1
- package/app/Header/index.js +1 -1
- package/app/PageTitle.js +1 -1
- package/app/i18n.js +1 -1
- package/core/Accordion/index.js +1 -1
- package/core/Blockquote/index.js +1 -1
- package/core/Button/index.js +1 -1
- package/core/Details/index.js +1 -1
- package/core/ErrorSummary/index.js +1 -1
- package/core/List/List.js +1 -1
- package/core/List/ListItem.js +1 -1
- package/core/List/ListItemContent.js +1 -1
- package/core/List/ListItemIcon.js +1 -1
- package/core/List/ListItemText.js +1 -1
- package/core/List/ListItemTitle.js +1 -1
- package/core/NavList/NavList.js +1 -1
- package/core/NavList/NavListItem.js +1 -1
- package/core/NavList/NavListItemBase.js +1 -1
- package/core/SummaryList/index.js +1 -1
- package/core/Tabs/index.js +1 -1
- package/core/WarningText/index.js +1 -1
- package/es/api/index.spec.js +112 -209
- package/es/govgr/Footer/Copyright.js +16 -0
- package/es/govgr/Footer/HellenicRepublicLogo.js +2 -0
- package/es/govgr/Footer/index.js +13 -9
- package/es/locales/el.js +1 -0
- package/es/locales/en.js +1 -0
- package/esm/api/index.spec.js +112 -209
- package/esm/govgr/Footer/Copyright.js +16 -0
- package/esm/govgr/Footer/HellenicRepublicLogo.js +2 -0
- package/esm/govgr/Footer/index.js +13 -9
- package/esm/index.js +1 -1
- package/esm/locales/el.js +1 -0
- package/esm/locales/en.js +1 -0
- package/govgr/Footer/Copyright.d.ts +1 -0
- package/govgr/Footer/Copyright.js +20 -1
- package/govgr/Footer/HellenicRepublicLogo.js +2 -0
- package/govgr/Footer/index.d.ts +1 -0
- package/govgr/Footer/index.js +21 -10
- package/hooks/useDebounce.js +1 -1
- package/hooks/useOutdatedBrowserCheck.js +1 -1
- package/hooks/useSearch.js +2 -2
- package/layouts/Basic/index.js +1 -1
- package/locales/el.d.ts +1 -0
- package/locales/el.js +1 -0
- package/locales/en.d.ts +1 -0
- package/locales/en.js +1 -0
- package/package.json +1 -1
- package/router/index.js +1 -1
- package/test-utils/delay.js +1 -1
- package/themes/index.js +4 -4
- package/typography/Paragraph.js +1 -1
- package/typography/index.js +8 -8
- package/utils/evaluateBrowserVersion.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
# Change Log - @digigov/ui
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue,
|
|
3
|
+
This log was last generated on Tue, 02 Nov 2021 13:03:39 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.8.4
|
|
6
|
+
Tue, 02 Nov 2021 13:03:39 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 0.8.3
|
|
11
|
+
Tue, 02 Nov 2021 12:05:42 GMT
|
|
12
|
+
|
|
13
|
+
### Patches
|
|
14
|
+
|
|
15
|
+
- Fix versions released by mistakes
|
|
16
|
+
|
|
17
|
+
## 0.8.1
|
|
18
|
+
Tue, 02 Nov 2021 08:25:41 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- fix api tests
|
|
23
|
+
|
|
24
|
+
## 0.8.0
|
|
25
|
+
Wed, 20 Oct 2021 12:45:51 GMT
|
|
26
|
+
|
|
27
|
+
### Minor changes
|
|
28
|
+
|
|
29
|
+
- Add new MinDigitalCopyright component to use as a copyright message for websites that we build for MinDigital
|
|
4
30
|
|
|
5
31
|
## 0.7.0
|
|
6
32
|
Tue, 12 Oct 2021 09:13:08 GMT
|
package/api/APIErrors.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports["default"] = exports.APIErrors = exports.APIError = void 0;
|
|
9
9
|
|
|
10
10
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
11
|
|
package/api/fetchAPI.js
CHANGED
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.fetchAPI = fetchAPI;
|
|
9
8
|
exports["default"] = void 0;
|
|
9
|
+
exports.fetchAPI = fetchAPI;
|
|
10
10
|
|
|
11
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
12
|
|
package/api/index.js
CHANGED
package/api/index.spec.js
CHANGED
|
@@ -20,7 +20,7 @@ var _fetchMock = _interopRequireDefault(require("fetch-mock"));
|
|
|
20
20
|
|
|
21
21
|
var _index = require("@digigov/ui/api/index");
|
|
22
22
|
|
|
23
|
-
var _delay = _interopRequireDefault(require("
|
|
23
|
+
var _delay = _interopRequireDefault(require("@digigov/ui/test-utils/delay"));
|
|
24
24
|
|
|
25
25
|
var _fetchAPI = _interopRequireDefault(require("@digigov/ui/api/fetchAPI"));
|
|
26
26
|
|
|
@@ -125,7 +125,7 @@ describe('fetchAPI', function () {
|
|
|
125
125
|
path = 'some_id';
|
|
126
126
|
|
|
127
127
|
_fetchMock["default"].mock.apply(_fetchMock["default"], (0, _toConsumableArray2["default"])(buildMockOptions({
|
|
128
|
-
resource: "".concat(resource, "/").concat(path),
|
|
128
|
+
resource: "".concat(resource, "/").concat(path, "/"),
|
|
129
129
|
response: {
|
|
130
130
|
value: 'SWR'
|
|
131
131
|
}
|
|
@@ -158,7 +158,7 @@ describe('useResource', function () {
|
|
|
158
158
|
beforeEach(_fetchMock["default"].resetBehavior);
|
|
159
159
|
beforeEach(_fetchMock["default"].resetHistory);
|
|
160
160
|
it('useResource should return data', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
161
|
-
var resource, Page, _render, container;
|
|
161
|
+
var resource, Page, _render, container, _container$firstChild, _container$firstChild2;
|
|
162
162
|
|
|
163
163
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
164
164
|
while (1) {
|
|
@@ -190,12 +190,12 @@ describe('useResource', function () {
|
|
|
190
190
|
break;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
193
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild = container.firstChild) === null || _container$firstChild === void 0 ? void 0 : _container$firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
194
194
|
_context2.next = 9;
|
|
195
195
|
return (0, _delay["default"])(DELAY);
|
|
196
196
|
|
|
197
197
|
case 9:
|
|
198
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
198
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild2 = container.firstChild) === null || _container$firstChild2 === void 0 ? void 0 : _container$firstChild2.textContent).toMatchInlineSnapshot("\"hello, SWR\"");
|
|
199
199
|
|
|
200
200
|
case 10:
|
|
201
201
|
expect(_fetchMock["default"].calls()).toHaveLength(1);
|
|
@@ -207,83 +207,20 @@ describe('useResource', function () {
|
|
|
207
207
|
}
|
|
208
208
|
}, _callee2);
|
|
209
209
|
})));
|
|
210
|
-
it('
|
|
211
|
-
var
|
|
210
|
+
it('should run duplicate request once', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
211
|
+
var _container$firstChild3, _container$firstChild4;
|
|
212
|
+
|
|
213
|
+
var resource, Page, _render2, container;
|
|
212
214
|
|
|
213
215
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
214
216
|
while (1) {
|
|
215
217
|
switch (_context3.prev = _context3.next) {
|
|
216
218
|
case 0:
|
|
217
219
|
Page = function _Page2() {
|
|
218
|
-
var _useResource2 = (0, _index.useResource)(resource),
|
|
219
|
-
data = _useResource2.data; // eslint-disable-next-line
|
|
220
|
-
// @ts-ignore
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
var _useResource3 = (0, _index.useResource)(resource2, function () {
|
|
224
|
-
return data.id;
|
|
225
|
-
}),
|
|
226
|
-
finalData = _useResource3.data;
|
|
227
|
-
|
|
228
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, "hello, ", finalData === null || finalData === void 0 ? void 0 : finalData.value);
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
resource = 'resource1';
|
|
232
|
-
resource2 = 'resource2';
|
|
233
|
-
|
|
234
|
-
_fetchMock["default"].mock.apply(_fetchMock["default"], (0, _toConsumableArray2["default"])(buildMockOptions({
|
|
235
|
-
resource: resource,
|
|
236
|
-
response: {
|
|
237
|
-
id: 'myid'
|
|
238
|
-
}
|
|
239
|
-
})));
|
|
240
|
-
|
|
241
|
-
_fetchMock["default"].mock.apply(_fetchMock["default"], (0, _toConsumableArray2["default"])(buildMockOptions({
|
|
242
|
-
resource: "".concat(resource2, "/myid"),
|
|
243
|
-
response: {
|
|
244
|
-
value: 'MyFriend'
|
|
245
|
-
}
|
|
246
|
-
})));
|
|
247
|
-
|
|
248
|
-
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Page, null), {
|
|
249
|
-
wrapper: wrapper
|
|
250
|
-
}), container = _render2.container;
|
|
251
|
-
expect(container.firstChild).not.toBe(null);
|
|
252
|
-
|
|
253
|
-
if (!container.firstChild) {
|
|
254
|
-
_context3.next = 12;
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"something went wrong\"");
|
|
259
|
-
_context3.next = 11;
|
|
260
|
-
return (0, _delay["default"])(DELAY * 2);
|
|
261
|
-
|
|
262
|
-
case 11:
|
|
263
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"something went wrong\"");
|
|
264
|
-
|
|
265
|
-
case 12:
|
|
266
|
-
expect(_fetchMock["default"].calls()).toHaveLength(2);
|
|
267
|
-
|
|
268
|
-
case 13:
|
|
269
|
-
case "end":
|
|
270
|
-
return _context3.stop();
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}, _callee3);
|
|
274
|
-
})));
|
|
275
|
-
it('should run duplicate request once', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
276
|
-
var resource, Page, _render3, container;
|
|
277
|
-
|
|
278
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
279
|
-
while (1) {
|
|
280
|
-
switch (_context4.prev = _context4.next) {
|
|
281
|
-
case 0:
|
|
282
|
-
Page = function _Page3() {
|
|
283
220
|
(0, _index.useResource)(resource);
|
|
284
221
|
|
|
285
|
-
var
|
|
286
|
-
duplData =
|
|
222
|
+
var _useResource2 = (0, _index.useResource)(resource),
|
|
223
|
+
duplData = _useResource2.data;
|
|
287
224
|
|
|
288
225
|
return /*#__PURE__*/_react["default"].createElement("div", null, "hello, ", duplData === null || duplData === void 0 ? void 0 : duplData.value);
|
|
289
226
|
};
|
|
@@ -297,32 +234,24 @@ describe('useResource', function () {
|
|
|
297
234
|
}
|
|
298
235
|
})));
|
|
299
236
|
|
|
300
|
-
|
|
237
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Page, null), {
|
|
301
238
|
wrapper: wrapper
|
|
302
|
-
}), container =
|
|
239
|
+
}), container = _render2.container;
|
|
303
240
|
expect(container.firstChild).not.toBe(null);
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
_context4.next = 10;
|
|
307
|
-
break;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
311
|
-
_context4.next = 9;
|
|
241
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild3 = container.firstChild) === null || _container$firstChild3 === void 0 ? void 0 : _container$firstChild3.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
242
|
+
_context3.next = 8;
|
|
312
243
|
return (0, _delay["default"])(DELAY);
|
|
313
244
|
|
|
314
|
-
case
|
|
315
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
316
|
-
|
|
317
|
-
case 10:
|
|
245
|
+
case 8:
|
|
246
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild4 = container.firstChild) === null || _container$firstChild4 === void 0 ? void 0 : _container$firstChild4.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
318
247
|
expect(_fetchMock["default"].calls()).toHaveLength(1);
|
|
319
248
|
|
|
320
|
-
case
|
|
249
|
+
case 10:
|
|
321
250
|
case "end":
|
|
322
|
-
return
|
|
251
|
+
return _context3.stop();
|
|
323
252
|
}
|
|
324
253
|
}
|
|
325
|
-
},
|
|
254
|
+
}, _callee3);
|
|
326
255
|
})));
|
|
327
256
|
});
|
|
328
257
|
describe('useResourceAction', function () {
|
|
@@ -332,14 +261,16 @@ describe('useResourceAction', function () {
|
|
|
332
261
|
});
|
|
333
262
|
beforeEach(_fetchMock["default"].resetBehavior);
|
|
334
263
|
beforeEach(_fetchMock["default"].resetHistory);
|
|
335
|
-
it('useResourceAction should return result ', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
336
|
-
var
|
|
264
|
+
it('useResourceAction should return result ', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
265
|
+
var _container$firstChild5, _container$firstChild6;
|
|
337
266
|
|
|
338
|
-
|
|
267
|
+
var resource, Page, _render3, container;
|
|
268
|
+
|
|
269
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
339
270
|
while (1) {
|
|
340
|
-
switch (
|
|
271
|
+
switch (_context4.prev = _context4.next) {
|
|
341
272
|
case 0:
|
|
342
|
-
Page = function
|
|
273
|
+
Page = function _Page3() {
|
|
343
274
|
var _useResourceAction = (0, _index.useResourceAction)(resource, undefined, 'POST', {
|
|
344
275
|
some: 'data'
|
|
345
276
|
}, undefined),
|
|
@@ -362,41 +293,35 @@ describe('useResourceAction', function () {
|
|
|
362
293
|
method: 'POST'
|
|
363
294
|
})));
|
|
364
295
|
|
|
365
|
-
|
|
296
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Page, null), {
|
|
366
297
|
wrapper: wrapper
|
|
367
|
-
}), container =
|
|
298
|
+
}), container = _render3.container;
|
|
368
299
|
expect(container.firstChild).not.toBe(null);
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
_context5.next = 10;
|
|
372
|
-
break;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
376
|
-
_context5.next = 9;
|
|
300
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild5 = container.firstChild) === null || _container$firstChild5 === void 0 ? void 0 : _container$firstChild5.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
301
|
+
_context4.next = 8;
|
|
377
302
|
return (0, _delay["default"])(DELAY * 2);
|
|
378
303
|
|
|
379
|
-
case
|
|
380
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
381
|
-
|
|
382
|
-
case 10:
|
|
304
|
+
case 8:
|
|
305
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild6 = container.firstChild) === null || _container$firstChild6 === void 0 ? void 0 : _container$firstChild6.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
383
306
|
expect(_fetchMock["default"].calls()).toHaveLength(1);
|
|
384
307
|
|
|
385
|
-
case
|
|
308
|
+
case 10:
|
|
386
309
|
case "end":
|
|
387
|
-
return
|
|
310
|
+
return _context4.stop();
|
|
388
311
|
}
|
|
389
312
|
}
|
|
390
|
-
},
|
|
313
|
+
}, _callee4);
|
|
391
314
|
})));
|
|
392
|
-
it('useResourceAction should be invalidated and run twice', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
393
|
-
var
|
|
315
|
+
it('useResourceAction should be invalidated and run twice', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
316
|
+
var _container$firstChild7, _container$firstChild8, _container$firstChild9, _container$firstChild10;
|
|
394
317
|
|
|
395
|
-
|
|
318
|
+
var resource, Page, _render4, container;
|
|
319
|
+
|
|
320
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
396
321
|
while (1) {
|
|
397
|
-
switch (
|
|
322
|
+
switch (_context5.prev = _context5.next) {
|
|
398
323
|
case 0:
|
|
399
|
-
Page = function
|
|
324
|
+
Page = function _Page4() {
|
|
400
325
|
var _useResourceAction2 = (0, _index.useResourceAction)(resource, undefined, 'POST', {
|
|
401
326
|
some: 'data'
|
|
402
327
|
}, undefined),
|
|
@@ -428,42 +353,34 @@ describe('useResourceAction', function () {
|
|
|
428
353
|
method: 'POST'
|
|
429
354
|
})));
|
|
430
355
|
|
|
431
|
-
|
|
356
|
+
_render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Page, null), {
|
|
432
357
|
wrapper: wrapper
|
|
433
|
-
}), container =
|
|
358
|
+
}), container = _render4.container;
|
|
434
359
|
expect(container.firstChild).not.toBe(null);
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
_context6.next = 16;
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
442
|
-
_context6.next = 9;
|
|
360
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild7 = container.firstChild) === null || _container$firstChild7 === void 0 ? void 0 : _container$firstChild7.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
361
|
+
_context5.next = 8;
|
|
443
362
|
return (0, _delay["default"])(DELAY);
|
|
444
363
|
|
|
445
|
-
case
|
|
446
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
447
|
-
|
|
364
|
+
case 8:
|
|
365
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild8 = container.firstChild) === null || _container$firstChild8 === void 0 ? void 0 : _container$firstChild8.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
366
|
+
_context5.next = 11;
|
|
448
367
|
return (0, _delay["default"])(DELAY);
|
|
449
368
|
|
|
450
|
-
case
|
|
451
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
452
|
-
|
|
369
|
+
case 11:
|
|
370
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild9 = container.firstChild) === null || _container$firstChild9 === void 0 ? void 0 : _container$firstChild9.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
371
|
+
_context5.next = 14;
|
|
453
372
|
return (0, _delay["default"])(DELAY * 2);
|
|
454
373
|
|
|
455
|
-
case
|
|
456
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
457
|
-
|
|
458
|
-
case 16:
|
|
374
|
+
case 14:
|
|
375
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild10 = container.firstChild) === null || _container$firstChild10 === void 0 ? void 0 : _container$firstChild10.textContent).toMatchInlineSnapshot("\"hello, myvalue\"");
|
|
459
376
|
expect(_fetchMock["default"].calls()).toHaveLength(2);
|
|
460
377
|
|
|
461
|
-
case
|
|
378
|
+
case 16:
|
|
462
379
|
case "end":
|
|
463
|
-
return
|
|
380
|
+
return _context5.stop();
|
|
464
381
|
}
|
|
465
382
|
}
|
|
466
|
-
},
|
|
383
|
+
}, _callee5);
|
|
467
384
|
})));
|
|
468
385
|
});
|
|
469
386
|
describe('useResourceMany', function () {
|
|
@@ -472,15 +389,18 @@ describe('useResourceMany', function () {
|
|
|
472
389
|
_fetchMock["default"].restore();
|
|
473
390
|
});
|
|
474
391
|
beforeEach(_fetchMock["default"].resetBehavior);
|
|
475
|
-
beforeEach(_fetchMock["default"].resetHistory);
|
|
476
|
-
it('useResourceMany should return data', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
477
|
-
var resource, Page, _render6, container;
|
|
392
|
+
beforeEach(_fetchMock["default"].resetHistory); //check this test again (loading/hello)
|
|
478
393
|
|
|
479
|
-
|
|
394
|
+
it('useResourceMany should return data', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
395
|
+
var _container$firstChild11, _container$firstChild12;
|
|
396
|
+
|
|
397
|
+
var resource, Page, _render5, container;
|
|
398
|
+
|
|
399
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
480
400
|
while (1) {
|
|
481
|
-
switch (
|
|
401
|
+
switch (_context6.prev = _context6.next) {
|
|
482
402
|
case 0:
|
|
483
|
-
Page = function
|
|
403
|
+
Page = function _Page5() {
|
|
484
404
|
var _useResourceMany = (0, _index.useResourceMany)(resource),
|
|
485
405
|
data = _useResourceMany.data;
|
|
486
406
|
|
|
@@ -504,41 +424,35 @@ describe('useResourceMany', function () {
|
|
|
504
424
|
}
|
|
505
425
|
})));
|
|
506
426
|
|
|
507
|
-
|
|
427
|
+
_render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Page, null), {
|
|
508
428
|
wrapper: wrapper
|
|
509
|
-
}), container =
|
|
429
|
+
}), container = _render5.container;
|
|
510
430
|
expect(container.firstChild).not.toBe(null);
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
_context7.next = 10;
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
518
|
-
_context7.next = 9;
|
|
431
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild11 = container.firstChild) === null || _container$firstChild11 === void 0 ? void 0 : _container$firstChild11.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
432
|
+
_context6.next = 8;
|
|
519
433
|
return (0, _delay["default"])(DELAY * 2);
|
|
520
434
|
|
|
521
|
-
case
|
|
522
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
523
|
-
|
|
524
|
-
case 10:
|
|
435
|
+
case 8:
|
|
436
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild12 = container.firstChild) === null || _container$firstChild12 === void 0 ? void 0 : _container$firstChild12.textContent).toMatchInlineSnapshot("\"hello, SWR\"");
|
|
525
437
|
expect(_fetchMock["default"].calls()).toHaveLength(1);
|
|
526
438
|
|
|
527
|
-
case
|
|
439
|
+
case 10:
|
|
528
440
|
case "end":
|
|
529
|
-
return
|
|
441
|
+
return _context6.stop();
|
|
530
442
|
}
|
|
531
443
|
}
|
|
532
|
-
},
|
|
444
|
+
}, _callee6);
|
|
533
445
|
})));
|
|
534
|
-
it('useResourceMany should handle hasNext, hasPrevious', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
535
|
-
var
|
|
446
|
+
it('useResourceMany should handle hasNext, hasPrevious', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
447
|
+
var _container$firstChild13, _container$firstChild14;
|
|
536
448
|
|
|
537
|
-
|
|
449
|
+
var resource, Page, _render6, container;
|
|
450
|
+
|
|
451
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
538
452
|
while (1) {
|
|
539
|
-
switch (
|
|
453
|
+
switch (_context7.prev = _context7.next) {
|
|
540
454
|
case 0:
|
|
541
|
-
Page = function
|
|
455
|
+
Page = function _Page6() {
|
|
542
456
|
var _useResourceMany2 = (0, _index.useResourceMany)(resource),
|
|
543
457
|
hasNext = _useResourceMany2.hasNext,
|
|
544
458
|
hasPrevious = _useResourceMany2.hasPrevious;
|
|
@@ -563,41 +477,35 @@ describe('useResourceMany', function () {
|
|
|
563
477
|
}
|
|
564
478
|
})));
|
|
565
479
|
|
|
566
|
-
|
|
480
|
+
_render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Page, null), {
|
|
567
481
|
wrapper: wrapper
|
|
568
|
-
}), container =
|
|
482
|
+
}), container = _render6.container;
|
|
569
483
|
expect(container.firstChild).not.toBe(null);
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
_context8.next = 10;
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
577
|
-
_context8.next = 9;
|
|
484
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild13 = container.firstChild) === null || _container$firstChild13 === void 0 ? void 0 : _container$firstChild13.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
485
|
+
_context7.next = 8;
|
|
578
486
|
return (0, _delay["default"])(DELAY);
|
|
579
487
|
|
|
580
|
-
case
|
|
581
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
582
|
-
|
|
583
|
-
case 10:
|
|
488
|
+
case 8:
|
|
489
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild14 = container.firstChild) === null || _container$firstChild14 === void 0 ? void 0 : _container$firstChild14.textContent).toMatchInlineSnapshot("\"no next,no previous\"");
|
|
584
490
|
expect(_fetchMock["default"].calls()).toHaveLength(1);
|
|
585
491
|
|
|
586
|
-
case
|
|
492
|
+
case 10:
|
|
587
493
|
case "end":
|
|
588
|
-
return
|
|
494
|
+
return _context7.stop();
|
|
589
495
|
}
|
|
590
496
|
}
|
|
591
|
-
},
|
|
497
|
+
}, _callee7);
|
|
592
498
|
})));
|
|
593
|
-
it('useResourceMany should handle setPage with custom limit option', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
594
|
-
var
|
|
499
|
+
it('useResourceMany should handle setPage with custom limit option', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
500
|
+
var _container$firstChild15, _container$firstChild16, _container$firstChild17;
|
|
595
501
|
|
|
596
|
-
|
|
502
|
+
var resource, Page, _render7, container, getByText;
|
|
503
|
+
|
|
504
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
597
505
|
while (1) {
|
|
598
|
-
switch (
|
|
506
|
+
switch (_context8.prev = _context8.next) {
|
|
599
507
|
case 0:
|
|
600
|
-
Page = function
|
|
508
|
+
Page = function _Page7() {
|
|
601
509
|
var _useResourceMany3 = (0, _index.useResourceMany)(resource, {
|
|
602
510
|
limit: 10
|
|
603
511
|
}),
|
|
@@ -646,39 +554,31 @@ describe('useResourceMany', function () {
|
|
|
646
554
|
}
|
|
647
555
|
})));
|
|
648
556
|
|
|
649
|
-
|
|
557
|
+
_render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(Page, null), {
|
|
650
558
|
wrapper: wrapper
|
|
651
|
-
}), container =
|
|
559
|
+
}), container = _render7.container, getByText = _render7.getByText;
|
|
652
560
|
expect(container.firstChild).not.toBe(null);
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
_context9.next = 15;
|
|
656
|
-
break;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
660
|
-
_context9.next = 10;
|
|
561
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild15 = container.firstChild) === null || _container$firstChild15 === void 0 ? void 0 : _container$firstChild15.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
562
|
+
_context8.next = 9;
|
|
661
563
|
return (0, _delay["default"])(DELAY);
|
|
662
564
|
|
|
663
|
-
case
|
|
664
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
565
|
+
case 9:
|
|
566
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild16 = container.firstChild) === null || _container$firstChild16 === void 0 ? void 0 : _container$firstChild16.textContent).toMatchInlineSnapshot("\"hello, SWRnext\"");
|
|
665
567
|
|
|
666
568
|
_react2.fireEvent.click(getByText('next'));
|
|
667
569
|
|
|
668
|
-
|
|
669
|
-
return (0, _delay["default"])(DELAY);
|
|
670
|
-
|
|
671
|
-
case 14:
|
|
672
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, RWSnext\"");
|
|
570
|
+
_context8.next = 13;
|
|
571
|
+
return (0, _delay["default"])(DELAY * 2);
|
|
673
572
|
|
|
674
|
-
case
|
|
573
|
+
case 13:
|
|
574
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild17 = container.firstChild) === null || _container$firstChild17 === void 0 ? void 0 : _container$firstChild17.textContent).toMatchInlineSnapshot("\"hello, RWSnext\"");
|
|
675
575
|
expect(_fetchMock["default"].calls()).toHaveLength(2);
|
|
676
576
|
|
|
677
|
-
case
|
|
577
|
+
case 15:
|
|
678
578
|
case "end":
|
|
679
|
-
return
|
|
579
|
+
return _context8.stop();
|
|
680
580
|
}
|
|
681
581
|
}
|
|
682
|
-
},
|
|
582
|
+
}, _callee8);
|
|
683
583
|
})));
|
|
684
584
|
});
|
package/api/useResourceQuery.js
CHANGED
|
@@ -5,8 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useResourceManyBase = useResourceManyBase;
|
|
9
8
|
exports.useResourceMany = useResourceMany;
|
|
9
|
+
exports.useResourceManyBase = useResourceManyBase;
|
|
10
10
|
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
12
|
|
package/api/utils.js
CHANGED
|
@@ -5,10 +5,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.parseErrors = parseErrors;
|
|
9
|
-
exports.processResponse = processResponse;
|
|
10
8
|
exports.getArgs = getArgs;
|
|
11
9
|
exports.getQueryKey = getQueryKey;
|
|
10
|
+
exports.parseErrors = parseErrors;
|
|
11
|
+
exports.processResponse = processResponse;
|
|
12
12
|
|
|
13
13
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
14
|
|
package/app/App.js
CHANGED
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports["default"] = exports.StaticApp =
|
|
10
|
+
exports.useAppStyles = exports["default"] = exports.StaticApp = void 0;
|
|
11
11
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
package/app/Header/HeaderLogo.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.HeaderLogo =
|
|
8
|
+
exports.useHeaderLogoStyles = exports["default"] = exports.HeaderLogo = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.HeaderSection =
|
|
8
|
+
exports.useHeaderSectionStyles = exports["default"] = exports.HeaderSection = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports.useHeaderTitleStyles = exports.useHeaderSubtitleStyles = exports["default"] = exports.HeaderTitle = exports.HeaderSubtitle = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
package/app/Header/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
useHeaderStyles: true,
|
|
10
10
|
Header: true
|
|
11
11
|
};
|
|
12
|
-
exports["default"] = exports.Header =
|
|
12
|
+
exports.useHeaderStyles = exports["default"] = exports.Header = void 0;
|
|
13
13
|
|
|
14
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
15
|
|