@plone/volto 17.0.1 → 17.1.1

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +36 -252
  3. package/addon-registry.js +6 -8
  4. package/cypress/support/commands.js +1 -2
  5. package/cypress/support/reset-fixture.js +2 -4
  6. package/jest-extender-plugin.js +3 -1
  7. package/locales/pt_BR/LC_MESSAGES/volto.po +1 -1
  8. package/locales/pt_BR.json +1 -1
  9. package/package.json +5 -4
  10. package/packages/volto-slate/package.json +1 -1
  11. package/pre-build-transpiling.js +1 -1
  12. package/razzle.config.js +6 -10
  13. package/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +3 -2
  14. package/src/components/manage/Blocks/LeadImage/View.jsx +1 -7
  15. package/src/components/manage/Blocks/LeadImage/View.test.jsx +22 -0
  16. package/src/components/manage/Blocks/LeadImage/utils.js +9 -0
  17. package/src/components/manage/Blocks/Listing/ListingData.jsx +3 -3
  18. package/src/components/manage/Blocks/Listing/ListingData.test.jsx +2 -0
  19. package/src/components/manage/UniversalLink/UniversalLink.jsx +3 -1
  20. package/src/components/theme/Comments/CommentEditModal.stories.jsx +64 -0
  21. package/src/components/theme/EventDetails/EventDetails.stories.jsx +88 -0
  22. package/src/components/theme/Header/Header.stories.jsx +47 -0
  23. package/src/components/theme/Image/Image.jsx +8 -11
  24. package/src/components/theme/Image/Image.test.jsx +11 -11
  25. package/src/components/theme/Login/Login.jsx +1 -1
  26. package/src/components/theme/Login/Login.stories.jsx +1 -1
  27. package/src/components/theme/Logo/Logo.Multilingual.test.jsx +5 -25
  28. package/src/components/theme/Logo/Logo.jsx +8 -6
  29. package/src/components/theme/Logo/Logo.stories.jsx +25 -1
  30. package/src/components/theme/Logo/Logo.test.jsx +6 -19
  31. package/src/components/theme/SearchWidget/SearchWidget.stories.jsx +36 -0
  32. package/src/config/Blocks.jsx +2 -0
  33. package/src/helpers/Url/Url.js +29 -0
  34. package/src/helpers/Url/Url.test.js +104 -0
  35. package/src/helpers/index.js +1 -0
@@ -18,6 +18,7 @@ import {
18
18
  checkAndNormalizeUrl,
19
19
  normaliseMail,
20
20
  normalizeTelephone,
21
+ flattenScales,
21
22
  } from './Url';
22
23
 
23
24
  beforeEach(() => {
@@ -350,4 +351,107 @@ describe('Url', () => {
350
351
  );
351
352
  });
352
353
  });
354
+ describe('flattenScales', () => {
355
+ it('flattenScales image is not set', () => {
356
+ const id = '/halfdome2022-2.jpg';
357
+ const image = undefined;
358
+ expect(flattenScales(id, image)).toBe(undefined);
359
+ });
360
+
361
+ it('flattenScales test from the catalog', () => {
362
+ const id = '/halfdome2022-2.jpg';
363
+ const image = {
364
+ 'content-type': 'image/jpeg',
365
+ download: '@@images/image-1182-cf763ae23c52340d8a17a7afdb26c8cb.jpeg',
366
+ filename: 'halfdome2022.jpg',
367
+ height: 665,
368
+ scales: {
369
+ great: {
370
+ download:
371
+ '@@images/image-1200-539ab119ebadc7d011798980a4a5e8d4.jpeg',
372
+ height: 665,
373
+ width: 1182,
374
+ },
375
+ huge: {
376
+ download:
377
+ '@@images/image-1600-188968febc677890c1b99d5339f9bef1.jpeg',
378
+ height: 665,
379
+ width: 1182,
380
+ },
381
+ },
382
+ size: 319364,
383
+ width: 1182,
384
+ };
385
+ expect(flattenScales(id, image)).toStrictEqual({
386
+ 'content-type': 'image/jpeg',
387
+ download: '@@images/image-1182-cf763ae23c52340d8a17a7afdb26c8cb.jpeg',
388
+ filename: 'halfdome2022.jpg',
389
+ height: 665,
390
+ scales: {
391
+ great: {
392
+ download:
393
+ '@@images/image-1200-539ab119ebadc7d011798980a4a5e8d4.jpeg',
394
+ height: 665,
395
+ width: 1182,
396
+ },
397
+ huge: {
398
+ download:
399
+ '@@images/image-1600-188968febc677890c1b99d5339f9bef1.jpeg',
400
+ height: 665,
401
+ width: 1182,
402
+ },
403
+ },
404
+ size: 319364,
405
+ width: 1182,
406
+ });
407
+ });
408
+ it('flattenScales test from serialization', () => {
409
+ const id = 'http://localhost:3000/halfdome2022-2.jpg';
410
+ const image = {
411
+ 'content-type': 'image/jpeg',
412
+ download:
413
+ 'http://localhost:3000/halfdome2022-2.jpg/@@images/image-1182-cf763ae23c52340d8a17a7afdb26c8cb.jpeg',
414
+ filename: 'halfdome2022.jpg',
415
+ height: 665,
416
+ scales: {
417
+ great: {
418
+ download:
419
+ 'http://localhost:3000/halfdome2022-2.jpg/@@images/image-1200-539ab119ebadc7d011798980a4a5e8d4.jpeg',
420
+ height: 665,
421
+ width: 1182,
422
+ },
423
+ huge: {
424
+ download:
425
+ 'http://localhost:3000/halfdome2022-2.jpg/@@images/image-1600-188968febc677890c1b99d5339f9bef1.jpeg',
426
+ height: 665,
427
+ width: 1182,
428
+ },
429
+ },
430
+ size: 319364,
431
+ width: 1182,
432
+ };
433
+ expect(flattenScales(id, image)).toStrictEqual({
434
+ 'content-type': 'image/jpeg',
435
+ download: '@@images/image-1182-cf763ae23c52340d8a17a7afdb26c8cb.jpeg',
436
+ filename: 'halfdome2022.jpg',
437
+ height: 665,
438
+ scales: {
439
+ great: {
440
+ download:
441
+ '@@images/image-1200-539ab119ebadc7d011798980a4a5e8d4.jpeg',
442
+ height: 665,
443
+ width: 1182,
444
+ },
445
+ huge: {
446
+ download:
447
+ '@@images/image-1600-188968febc677890c1b99d5339f9bef1.jpeg',
448
+ height: 665,
449
+ width: 1182,
450
+ },
451
+ },
452
+ size: 319364,
453
+ width: 1182,
454
+ });
455
+ });
456
+ });
353
457
  });
@@ -29,6 +29,7 @@ export {
29
29
  normalizeUrl,
30
30
  removeProtocol,
31
31
  URLUtils,
32
+ flattenScales,
32
33
  } from '@plone/volto/helpers/Url/Url';
33
34
  export { generateRobots } from '@plone/volto/helpers/Robots/Robots';
34
35
  export {