@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/esm/api/index.spec.js
CHANGED
|
@@ -8,7 +8,7 @@ import React, { Suspense, useEffect } from 'react';
|
|
|
8
8
|
import { render, fireEvent } from '@testing-library/react';
|
|
9
9
|
import fetchMock from 'fetch-mock';
|
|
10
10
|
import { APIProvider, useResource, useResourceAction, useResourceMany, APIErrors } from '@digigov/ui/api/index';
|
|
11
|
-
import delay from '
|
|
11
|
+
import delay from '@digigov/ui/test-utils/delay';
|
|
12
12
|
import fetchAPI from '@digigov/ui/api/fetchAPI';
|
|
13
13
|
import 'whatwg-fetch';
|
|
14
14
|
|
|
@@ -105,7 +105,7 @@ describe('fetchAPI', function () {
|
|
|
105
105
|
resource = 'resource';
|
|
106
106
|
path = 'some_id';
|
|
107
107
|
fetchMock.mock.apply(fetchMock, _toConsumableArray(buildMockOptions({
|
|
108
|
-
resource: "".concat(resource, "/").concat(path),
|
|
108
|
+
resource: "".concat(resource, "/").concat(path, "/"),
|
|
109
109
|
response: {
|
|
110
110
|
value: 'SWR'
|
|
111
111
|
}
|
|
@@ -137,7 +137,7 @@ describe('useResource', function () {
|
|
|
137
137
|
beforeEach(fetchMock.resetBehavior);
|
|
138
138
|
beforeEach(fetchMock.resetHistory);
|
|
139
139
|
it('useResource should return data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
140
|
-
var resource, Page, _render, container;
|
|
140
|
+
var resource, Page, _render, container, _container$firstChild, _container$firstChild2;
|
|
141
141
|
|
|
142
142
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
143
143
|
while (1) {
|
|
@@ -167,12 +167,12 @@ describe('useResource', function () {
|
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
170
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild = container.firstChild) === null || _container$firstChild === void 0 ? void 0 : _container$firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
171
171
|
_context2.next = 9;
|
|
172
172
|
return delay(DELAY);
|
|
173
173
|
|
|
174
174
|
case 9:
|
|
175
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
175
|
+
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\"");
|
|
176
176
|
|
|
177
177
|
case 10:
|
|
178
178
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
@@ -184,80 +184,20 @@ describe('useResource', function () {
|
|
|
184
184
|
}
|
|
185
185
|
}, _callee2);
|
|
186
186
|
})));
|
|
187
|
-
it('
|
|
188
|
-
var
|
|
187
|
+
it('should run duplicate request once', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
188
|
+
var _container$firstChild3, _container$firstChild4;
|
|
189
|
+
|
|
190
|
+
var resource, Page, _render2, container;
|
|
189
191
|
|
|
190
192
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
191
193
|
while (1) {
|
|
192
194
|
switch (_context3.prev = _context3.next) {
|
|
193
195
|
case 0:
|
|
194
196
|
Page = function _Page2() {
|
|
195
|
-
var _useResource2 = useResource(resource),
|
|
196
|
-
data = _useResource2.data; // eslint-disable-next-line
|
|
197
|
-
// @ts-ignore
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
var _useResource3 = useResource(resource2, function () {
|
|
201
|
-
return data.id;
|
|
202
|
-
}),
|
|
203
|
-
finalData = _useResource3.data;
|
|
204
|
-
|
|
205
|
-
return /*#__PURE__*/React.createElement("div", null, "hello, ", finalData === null || finalData === void 0 ? void 0 : finalData.value);
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
resource = 'resource1';
|
|
209
|
-
resource2 = 'resource2';
|
|
210
|
-
fetchMock.mock.apply(fetchMock, _toConsumableArray(buildMockOptions({
|
|
211
|
-
resource: resource,
|
|
212
|
-
response: {
|
|
213
|
-
id: 'myid'
|
|
214
|
-
}
|
|
215
|
-
})));
|
|
216
|
-
fetchMock.mock.apply(fetchMock, _toConsumableArray(buildMockOptions({
|
|
217
|
-
resource: "".concat(resource2, "/myid"),
|
|
218
|
-
response: {
|
|
219
|
-
value: 'MyFriend'
|
|
220
|
-
}
|
|
221
|
-
})));
|
|
222
|
-
_render2 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
223
|
-
wrapper: wrapper
|
|
224
|
-
}), container = _render2.container;
|
|
225
|
-
expect(container.firstChild).not.toBe(null);
|
|
226
|
-
|
|
227
|
-
if (!container.firstChild) {
|
|
228
|
-
_context3.next = 12;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"something went wrong\"");
|
|
233
|
-
_context3.next = 11;
|
|
234
|
-
return delay(DELAY * 2);
|
|
235
|
-
|
|
236
|
-
case 11:
|
|
237
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"something went wrong\"");
|
|
238
|
-
|
|
239
|
-
case 12:
|
|
240
|
-
expect(fetchMock.calls()).toHaveLength(2);
|
|
241
|
-
|
|
242
|
-
case 13:
|
|
243
|
-
case "end":
|
|
244
|
-
return _context3.stop();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}, _callee3);
|
|
248
|
-
})));
|
|
249
|
-
it('should run duplicate request once', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
250
|
-
var resource, Page, _render3, container;
|
|
251
|
-
|
|
252
|
-
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
253
|
-
while (1) {
|
|
254
|
-
switch (_context4.prev = _context4.next) {
|
|
255
|
-
case 0:
|
|
256
|
-
Page = function _Page3() {
|
|
257
197
|
useResource(resource);
|
|
258
198
|
|
|
259
|
-
var
|
|
260
|
-
duplData =
|
|
199
|
+
var _useResource2 = useResource(resource),
|
|
200
|
+
duplData = _useResource2.data;
|
|
261
201
|
|
|
262
202
|
return /*#__PURE__*/React.createElement("div", null, "hello, ", duplData === null || duplData === void 0 ? void 0 : duplData.value);
|
|
263
203
|
};
|
|
@@ -269,32 +209,24 @@ describe('useResource', function () {
|
|
|
269
209
|
value: 'myvalue'
|
|
270
210
|
}
|
|
271
211
|
})));
|
|
272
|
-
|
|
212
|
+
_render2 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
273
213
|
wrapper: wrapper
|
|
274
|
-
}), container =
|
|
214
|
+
}), container = _render2.container;
|
|
275
215
|
expect(container.firstChild).not.toBe(null);
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
_context4.next = 10;
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
283
|
-
_context4.next = 9;
|
|
216
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild3 = container.firstChild) === null || _container$firstChild3 === void 0 ? void 0 : _container$firstChild3.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
217
|
+
_context3.next = 8;
|
|
284
218
|
return delay(DELAY);
|
|
285
219
|
|
|
286
|
-
case
|
|
287
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
288
|
-
|
|
289
|
-
case 10:
|
|
220
|
+
case 8:
|
|
221
|
+
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\"");
|
|
290
222
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
291
223
|
|
|
292
|
-
case
|
|
224
|
+
case 10:
|
|
293
225
|
case "end":
|
|
294
|
-
return
|
|
226
|
+
return _context3.stop();
|
|
295
227
|
}
|
|
296
228
|
}
|
|
297
|
-
},
|
|
229
|
+
}, _callee3);
|
|
298
230
|
})));
|
|
299
231
|
});
|
|
300
232
|
describe('useResourceAction', function () {
|
|
@@ -304,14 +236,16 @@ describe('useResourceAction', function () {
|
|
|
304
236
|
});
|
|
305
237
|
beforeEach(fetchMock.resetBehavior);
|
|
306
238
|
beforeEach(fetchMock.resetHistory);
|
|
307
|
-
it('useResourceAction should return result ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
308
|
-
var
|
|
239
|
+
it('useResourceAction should return result ', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
240
|
+
var _container$firstChild5, _container$firstChild6;
|
|
309
241
|
|
|
310
|
-
|
|
242
|
+
var resource, Page, _render3, container;
|
|
243
|
+
|
|
244
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
311
245
|
while (1) {
|
|
312
|
-
switch (
|
|
246
|
+
switch (_context4.prev = _context4.next) {
|
|
313
247
|
case 0:
|
|
314
|
-
Page = function
|
|
248
|
+
Page = function _Page3() {
|
|
315
249
|
var _useResourceAction = useResourceAction(resource, undefined, 'POST', {
|
|
316
250
|
some: 'data'
|
|
317
251
|
}, undefined),
|
|
@@ -332,41 +266,35 @@ describe('useResourceAction', function () {
|
|
|
332
266
|
},
|
|
333
267
|
method: 'POST'
|
|
334
268
|
})));
|
|
335
|
-
|
|
269
|
+
_render3 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
336
270
|
wrapper: wrapper
|
|
337
|
-
}), container =
|
|
271
|
+
}), container = _render3.container;
|
|
338
272
|
expect(container.firstChild).not.toBe(null);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
_context5.next = 10;
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
346
|
-
_context5.next = 9;
|
|
273
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild5 = container.firstChild) === null || _container$firstChild5 === void 0 ? void 0 : _container$firstChild5.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
274
|
+
_context4.next = 8;
|
|
347
275
|
return delay(DELAY * 2);
|
|
348
276
|
|
|
349
|
-
case
|
|
350
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
351
|
-
|
|
352
|
-
case 10:
|
|
277
|
+
case 8:
|
|
278
|
+
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\"");
|
|
353
279
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
354
280
|
|
|
355
|
-
case
|
|
281
|
+
case 10:
|
|
356
282
|
case "end":
|
|
357
|
-
return
|
|
283
|
+
return _context4.stop();
|
|
358
284
|
}
|
|
359
285
|
}
|
|
360
|
-
},
|
|
286
|
+
}, _callee4);
|
|
361
287
|
})));
|
|
362
|
-
it('useResourceAction should be invalidated and run twice', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
363
|
-
var
|
|
288
|
+
it('useResourceAction should be invalidated and run twice', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
289
|
+
var _container$firstChild7, _container$firstChild8, _container$firstChild9, _container$firstChild10;
|
|
364
290
|
|
|
365
|
-
|
|
291
|
+
var resource, Page, _render4, container;
|
|
292
|
+
|
|
293
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
366
294
|
while (1) {
|
|
367
|
-
switch (
|
|
295
|
+
switch (_context5.prev = _context5.next) {
|
|
368
296
|
case 0:
|
|
369
|
-
Page = function
|
|
297
|
+
Page = function _Page4() {
|
|
370
298
|
var _useResourceAction2 = useResourceAction(resource, undefined, 'POST', {
|
|
371
299
|
some: 'data'
|
|
372
300
|
}, undefined),
|
|
@@ -396,42 +324,34 @@ describe('useResourceAction', function () {
|
|
|
396
324
|
},
|
|
397
325
|
method: 'POST'
|
|
398
326
|
})));
|
|
399
|
-
|
|
327
|
+
_render4 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
400
328
|
wrapper: wrapper
|
|
401
|
-
}), container =
|
|
329
|
+
}), container = _render4.container;
|
|
402
330
|
expect(container.firstChild).not.toBe(null);
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
_context6.next = 16;
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
410
|
-
_context6.next = 9;
|
|
331
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild7 = container.firstChild) === null || _container$firstChild7 === void 0 ? void 0 : _container$firstChild7.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
332
|
+
_context5.next = 8;
|
|
411
333
|
return delay(DELAY);
|
|
412
334
|
|
|
413
|
-
case
|
|
414
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
415
|
-
|
|
335
|
+
case 8:
|
|
336
|
+
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\"");
|
|
337
|
+
_context5.next = 11;
|
|
416
338
|
return delay(DELAY);
|
|
417
339
|
|
|
418
|
-
case
|
|
419
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
420
|
-
|
|
340
|
+
case 11:
|
|
341
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild9 = container.firstChild) === null || _container$firstChild9 === void 0 ? void 0 : _container$firstChild9.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
342
|
+
_context5.next = 14;
|
|
421
343
|
return delay(DELAY * 2);
|
|
422
344
|
|
|
423
|
-
case
|
|
424
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, \"");
|
|
425
|
-
|
|
426
|
-
case 16:
|
|
345
|
+
case 14:
|
|
346
|
+
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\"");
|
|
427
347
|
expect(fetchMock.calls()).toHaveLength(2);
|
|
428
348
|
|
|
429
|
-
case
|
|
349
|
+
case 16:
|
|
430
350
|
case "end":
|
|
431
|
-
return
|
|
351
|
+
return _context5.stop();
|
|
432
352
|
}
|
|
433
353
|
}
|
|
434
|
-
},
|
|
354
|
+
}, _callee5);
|
|
435
355
|
})));
|
|
436
356
|
});
|
|
437
357
|
describe('useResourceMany', function () {
|
|
@@ -440,15 +360,18 @@ describe('useResourceMany', function () {
|
|
|
440
360
|
fetchMock.restore();
|
|
441
361
|
});
|
|
442
362
|
beforeEach(fetchMock.resetBehavior);
|
|
443
|
-
beforeEach(fetchMock.resetHistory);
|
|
444
|
-
it('useResourceMany should return data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
445
|
-
var resource, Page, _render6, container;
|
|
363
|
+
beforeEach(fetchMock.resetHistory); //check this test again (loading/hello)
|
|
446
364
|
|
|
447
|
-
|
|
365
|
+
it('useResourceMany should return data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
366
|
+
var _container$firstChild11, _container$firstChild12;
|
|
367
|
+
|
|
368
|
+
var resource, Page, _render5, container;
|
|
369
|
+
|
|
370
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
448
371
|
while (1) {
|
|
449
|
-
switch (
|
|
372
|
+
switch (_context6.prev = _context6.next) {
|
|
450
373
|
case 0:
|
|
451
|
-
Page = function
|
|
374
|
+
Page = function _Page5() {
|
|
452
375
|
var _useResourceMany = useResourceMany(resource),
|
|
453
376
|
data = _useResourceMany.data;
|
|
454
377
|
|
|
@@ -470,41 +393,35 @@ describe('useResourceMany', function () {
|
|
|
470
393
|
}
|
|
471
394
|
}
|
|
472
395
|
})));
|
|
473
|
-
|
|
396
|
+
_render5 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
474
397
|
wrapper: wrapper
|
|
475
|
-
}), container =
|
|
398
|
+
}), container = _render5.container;
|
|
476
399
|
expect(container.firstChild).not.toBe(null);
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
_context7.next = 10;
|
|
480
|
-
break;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
484
|
-
_context7.next = 9;
|
|
400
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild11 = container.firstChild) === null || _container$firstChild11 === void 0 ? void 0 : _container$firstChild11.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
401
|
+
_context6.next = 8;
|
|
485
402
|
return delay(DELAY * 2);
|
|
486
403
|
|
|
487
|
-
case
|
|
488
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
489
|
-
|
|
490
|
-
case 10:
|
|
404
|
+
case 8:
|
|
405
|
+
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\"");
|
|
491
406
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
492
407
|
|
|
493
|
-
case
|
|
408
|
+
case 10:
|
|
494
409
|
case "end":
|
|
495
|
-
return
|
|
410
|
+
return _context6.stop();
|
|
496
411
|
}
|
|
497
412
|
}
|
|
498
|
-
},
|
|
413
|
+
}, _callee6);
|
|
499
414
|
})));
|
|
500
|
-
it('useResourceMany should handle hasNext, hasPrevious', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
501
|
-
var
|
|
415
|
+
it('useResourceMany should handle hasNext, hasPrevious', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
416
|
+
var _container$firstChild13, _container$firstChild14;
|
|
502
417
|
|
|
503
|
-
|
|
418
|
+
var resource, Page, _render6, container;
|
|
419
|
+
|
|
420
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
504
421
|
while (1) {
|
|
505
|
-
switch (
|
|
422
|
+
switch (_context7.prev = _context7.next) {
|
|
506
423
|
case 0:
|
|
507
|
-
Page = function
|
|
424
|
+
Page = function _Page6() {
|
|
508
425
|
var _useResourceMany2 = useResourceMany(resource),
|
|
509
426
|
hasNext = _useResourceMany2.hasNext,
|
|
510
427
|
hasPrevious = _useResourceMany2.hasPrevious;
|
|
@@ -527,41 +444,35 @@ describe('useResourceMany', function () {
|
|
|
527
444
|
}
|
|
528
445
|
}
|
|
529
446
|
})));
|
|
530
|
-
|
|
447
|
+
_render6 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
531
448
|
wrapper: wrapper
|
|
532
|
-
}), container =
|
|
449
|
+
}), container = _render6.container;
|
|
533
450
|
expect(container.firstChild).not.toBe(null);
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
_context8.next = 10;
|
|
537
|
-
break;
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
541
|
-
_context8.next = 9;
|
|
451
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild13 = container.firstChild) === null || _container$firstChild13 === void 0 ? void 0 : _container$firstChild13.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
452
|
+
_context7.next = 8;
|
|
542
453
|
return delay(DELAY);
|
|
543
454
|
|
|
544
|
-
case
|
|
545
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
546
|
-
|
|
547
|
-
case 10:
|
|
455
|
+
case 8:
|
|
456
|
+
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\"");
|
|
548
457
|
expect(fetchMock.calls()).toHaveLength(1);
|
|
549
458
|
|
|
550
|
-
case
|
|
459
|
+
case 10:
|
|
551
460
|
case "end":
|
|
552
|
-
return
|
|
461
|
+
return _context7.stop();
|
|
553
462
|
}
|
|
554
463
|
}
|
|
555
|
-
},
|
|
464
|
+
}, _callee7);
|
|
556
465
|
})));
|
|
557
|
-
it('useResourceMany should handle setPage with custom limit option', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
558
|
-
var
|
|
466
|
+
it('useResourceMany should handle setPage with custom limit option', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
467
|
+
var _container$firstChild15, _container$firstChild16, _container$firstChild17;
|
|
468
|
+
|
|
469
|
+
var resource, Page, _render7, container, getByText;
|
|
559
470
|
|
|
560
|
-
return _regeneratorRuntime.wrap(function
|
|
471
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
561
472
|
while (1) {
|
|
562
|
-
switch (
|
|
473
|
+
switch (_context8.prev = _context8.next) {
|
|
563
474
|
case 0:
|
|
564
|
-
Page = function
|
|
475
|
+
Page = function _Page7() {
|
|
565
476
|
var _useResourceMany3 = useResourceMany(resource, {
|
|
566
477
|
limit: 10
|
|
567
478
|
}),
|
|
@@ -607,37 +518,29 @@ describe('useResourceMany', function () {
|
|
|
607
518
|
}
|
|
608
519
|
}
|
|
609
520
|
})));
|
|
610
|
-
|
|
521
|
+
_render7 = render( /*#__PURE__*/React.createElement(Page, null), {
|
|
611
522
|
wrapper: wrapper
|
|
612
|
-
}), container =
|
|
523
|
+
}), container = _render7.container, getByText = _render7.getByText;
|
|
613
524
|
expect(container.firstChild).not.toBe(null);
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
_context9.next = 15;
|
|
617
|
-
break;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
621
|
-
_context9.next = 10;
|
|
525
|
+
expect(container === null || container === void 0 ? void 0 : (_container$firstChild15 = container.firstChild) === null || _container$firstChild15 === void 0 ? void 0 : _container$firstChild15.textContent).toMatchInlineSnapshot("\"Loading\"");
|
|
526
|
+
_context8.next = 9;
|
|
622
527
|
return delay(DELAY);
|
|
623
528
|
|
|
624
|
-
case
|
|
625
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"
|
|
529
|
+
case 9:
|
|
530
|
+
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\"");
|
|
626
531
|
fireEvent.click(getByText('next'));
|
|
627
|
-
|
|
628
|
-
return delay(DELAY);
|
|
629
|
-
|
|
630
|
-
case 14:
|
|
631
|
-
expect(container.firstChild.textContent).toMatchInlineSnapshot("\"hello, RWSnext\"");
|
|
532
|
+
_context8.next = 13;
|
|
533
|
+
return delay(DELAY * 2);
|
|
632
534
|
|
|
633
|
-
case
|
|
535
|
+
case 13:
|
|
536
|
+
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\"");
|
|
634
537
|
expect(fetchMock.calls()).toHaveLength(2);
|
|
635
538
|
|
|
636
|
-
case
|
|
539
|
+
case 15:
|
|
637
540
|
case "end":
|
|
638
|
-
return
|
|
541
|
+
return _context8.stop();
|
|
639
542
|
}
|
|
640
543
|
}
|
|
641
|
-
},
|
|
544
|
+
}, _callee8);
|
|
642
545
|
})));
|
|
643
546
|
});
|
|
@@ -39,4 +39,20 @@ export var Copyright = function Copyright(_ref) {
|
|
|
39
39
|
rel: "noopener noreferrer"
|
|
40
40
|
}, t('footer.open_source'))));
|
|
41
41
|
};
|
|
42
|
+
export var MinDigitalCopyright = function MinDigitalCopyright(_ref2) {
|
|
43
|
+
var _ref2$copyright = _ref2.copyright,
|
|
44
|
+
copyright = _ref2$copyright === void 0 ? getCopyright() : _ref2$copyright;
|
|
45
|
+
var classes = useStyles();
|
|
46
|
+
|
|
47
|
+
var _useTranslation2 = useTranslation(),
|
|
48
|
+
t = _useTranslation2.t;
|
|
49
|
+
|
|
50
|
+
return /*#__PURE__*/React.createElement(NormalText, {
|
|
51
|
+
className: classes.text
|
|
52
|
+
}, copyright, ' - ', /*#__PURE__*/React.createElement(React.Fragment, null, t('footer.created_by'), ' ', /*#__PURE__*/React.createElement("a", {
|
|
53
|
+
href: "https://mindigital.gr",
|
|
54
|
+
target: "_blank",
|
|
55
|
+
rel: "noopener noreferrer"
|
|
56
|
+
}, t('footer.mindigital')), ' '));
|
|
57
|
+
};
|
|
42
58
|
export default Copyright;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["copyright", "className", "children", "createdBy"],
|
|
3
|
+
var _excluded = ["copyright", "className", "children", "createdBy", "minDigitalCopyright"],
|
|
4
4
|
_excluded2 = ["reportBugs"];
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -9,7 +9,7 @@ import Grid from '@material-ui/core/Grid';
|
|
|
9
9
|
import { Content } from '@digigov/ui/layouts/Basic';
|
|
10
10
|
import Button from '@digigov/ui/core/Button';
|
|
11
11
|
import Title from '@digigov/ui/typography/Title';
|
|
12
|
-
import Copyright from '@digigov/ui/govgr/Footer/Copyright';
|
|
12
|
+
import Copyright, { MinDigitalCopyright } from '@digigov/ui/govgr/Footer/Copyright';
|
|
13
13
|
import HellenicRepublicLogo from '@digigov/ui/govgr/Footer/HellenicRepublicLogo';
|
|
14
14
|
var useStyles = makeStyles(function (theme) {
|
|
15
15
|
return {
|
|
@@ -36,7 +36,9 @@ var useStyles = makeStyles(function (theme) {
|
|
|
36
36
|
name: 'MuiGovGRFooter'
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
var _ref2 = /*#__PURE__*/React.createElement(
|
|
39
|
+
var _ref2 = /*#__PURE__*/React.createElement(MinDigitalCopyright, null);
|
|
40
|
+
|
|
41
|
+
var _ref3 = /*#__PURE__*/React.createElement(HellenicRepublicLogo, null);
|
|
40
42
|
|
|
41
43
|
export var GovGRFooter = function GovGRFooter(_ref) {
|
|
42
44
|
var copyright = _ref.copyright,
|
|
@@ -44,6 +46,8 @@ export var GovGRFooter = function GovGRFooter(_ref) {
|
|
|
44
46
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
45
47
|
children = _ref.children,
|
|
46
48
|
createdBy = _ref.createdBy,
|
|
49
|
+
_ref$minDigitalCopyri = _ref.minDigitalCopyright,
|
|
50
|
+
minDigitalCopyright = _ref$minDigitalCopyri === void 0 ? false : _ref$minDigitalCopyri,
|
|
47
51
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
48
52
|
|
|
49
53
|
var classes = useStyles();
|
|
@@ -55,14 +59,14 @@ export var GovGRFooter = function GovGRFooter(_ref) {
|
|
|
55
59
|
item: true,
|
|
56
60
|
xs: 12,
|
|
57
61
|
sm: 8
|
|
58
|
-
}, copyright
|
|
62
|
+
}, copyright ? copyright : minDigitalCopyright ? _ref2 : /*#__PURE__*/React.createElement(Copyright, {
|
|
59
63
|
createdBy: createdBy
|
|
60
64
|
})), /*#__PURE__*/React.createElement(Grid, {
|
|
61
65
|
item: true,
|
|
62
66
|
xs: 12,
|
|
63
67
|
sm: 4,
|
|
64
68
|
className: classes.logoContainer
|
|
65
|
-
},
|
|
69
|
+
}, _ref3))));
|
|
66
70
|
};
|
|
67
71
|
var useFeedbackStyles = makeStyles(function (theme) {
|
|
68
72
|
return {
|
|
@@ -97,10 +101,10 @@ var useFeedbackStyles = makeStyles(function (theme) {
|
|
|
97
101
|
}, {
|
|
98
102
|
name: 'MuiFeedback'
|
|
99
103
|
});
|
|
100
|
-
export var Feedback = function Feedback(
|
|
101
|
-
var
|
|
102
|
-
reportBugs =
|
|
103
|
-
props = _objectWithoutProperties(
|
|
104
|
+
export var Feedback = function Feedback(_ref4) {
|
|
105
|
+
var _ref4$reportBugs = _ref4.reportBugs,
|
|
106
|
+
reportBugs = _ref4$reportBugs === void 0 ? false : _ref4$reportBugs,
|
|
107
|
+
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
104
108
|
|
|
105
109
|
var classes = useFeedbackStyles();
|
|
106
110
|
return /*#__PURE__*/React.createElement("div", {
|
package/esm/index.js
CHANGED
package/esm/locales/el.js
CHANGED
package/esm/locales/en.js
CHANGED