diff --git a/CHANGELOG.md b/CHANGELOG.md index cc4be4a142..d4ecb4fe13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,49 @@ +## 17.0.0-alpha.25 (2023-08-25) + +### Breaking + +- Spin off relation stats action. Get relation stats with getRelationStats() instead of with queryRelations(). @ksuess + Refactor relations actions: slightly change the shape of the redux state for `queryRelations` to follow common signatures. @ksuess [#5041](https://github.com/plone/volto/issues/5041) + +### Feature + +- Refactor Comment -@Tishasoumya-02 [#4074](https://github.com/plone/volto/issues/4074) +- Refactor Logout component @Tishasoumya-02 [#4860](https://github.com/plone/volto/issues/4860) +- Refactore SearchTags @Tishasoumya-02 [#4873](https://github.com/plone/volto/issues/4873) + +### Bugfix + +- Allow a user to register when they use an email address as their username. [#5031](https://github.com/plone/volto/issues/5031) @mehedikhan72 [#5031](https://github.com/plone/volto/issues/5031) +- Fix querystringResults subrequests id, to work properly in duplicate pages where blocks id's are the same. @giuliaghisini [#5070](https://github.com/plone/volto/issues/5070) +- Fix i18n for link settings fieldset in the image block @iRohitSingh [#5075](https://github.com/plone/volto/issues/5075) +- Prevent caching the outdated browser message in a shared cache. @davisagli [#5076](https://github.com/plone/volto/issues/5076) +- Fix accessibility of the content folder buttons. @SaraBianchi [#5101](https://github.com/plone/volto/issues/5101) +- For folders inside navigation roots, properly fetch navigation from the + navroot, rather then the site root @tiberiuichim [#5106](https://github.com/plone/volto/issues/5106) +- Fix uncached case when the widget is slate on diff @dobri1408 [#5107](https://github.com/plone/volto/issues/5107) +- Fix load addon translations: last addon translations wins @giuliaghisini [#5113](https://github.com/plone/volto/issues/5113) +- [Visual bugfix] Match the original mockups for PastanagaUI in regards of the error messages in form field elements @sneridagh [#5115](https://github.com/plone/volto/issues/5115) +- Fix default toc renderer for nested entries @pnicolli [#5116](https://github.com/plone/volto/issues/5116) +- Fix inherit checkbox in sharing view @sneridagh [#5514](https://github.com/plone/volto/issues/5514) + +### Internal + +- Improved spellcheck to keep spellings consistent. @chirayu-humar [#1190](https://github.com/plone/volto/issues/1190) + +### Documentation + +- Update links to contributing. @stevepiercy [#5084](https://github.com/plone/volto/issues/5084) +- Accept `plone` and `volto` in labels with janky regex. Include Vale styles directory for checking spelling and styles. @stevepiercy [#5095](https://github.com/plone/volto/issues/5095) + + ## 17.0.0-alpha.24 (2023-08-09) ### Breaking @@ -23,6 +61,9 @@ - Fix 302 redirect in changelog. @stevepiercy [#5068](https://github.com/plone/volto/issues/5068) +### Internal + +- Add https://www.dlr.de/de to "Volto in production" list. @tisto [#5112](https://github.com/plone/volto/pull/5112) ## 17.0.0-alpha.23 (2023-07-28) diff --git a/README.md b/README.md index 9ac6dc757f..ca0357bec7 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ Volto is actively developed since 2017 and used in production since 2018 on the - [Helmholtz-Institut Erlangen-Nürnberg für Erneuerbare Energien (HI-ERN)](https://www.hi-ern.de) (Website for HI ERN, a research institution for renewable energies, developed by [kitconcept GmbH](https://kitconcept.com), 2022) - [Lanku](https://www.lanku.eus) (Website for Lanku Kultur Zerbitzuak, a company offering cultural services and improvised Basque verse singing sessions across the Basque Country, developed by [CodeSyntax](https://www.codesyntax.com/en), 2023) - [UEU](https://www.ueu.eus) (Website for Udako Euskal Unibertsitatea, a non-profit University offering all its service only in Basque: courses, publications, ... developed by [CodeSyntax](https://www.codesyntax.com/en), 2023) +- [German Aerospace Center (DLR)](https://www.dlr.de/de) (The German Aerospace Center (DLR) is the Federal Republic of Germany's research center for aeronautics. With more than 10.000 employees and a yearly budget of more than 1 billion euros, it is one of the largest research institutions in Germany, developed by [kitconcept GmbH](https://kitconcept.com), 2023) Please create a new [issue](https://github.com/plone/volto/issues/new) or [pull request](https://github.com/plone/volto/pulls) to add your Volto-site here! diff --git a/cypress/tests/core/basic/logout.js b/cypress/tests/core/basic/logout.js new file mode 100644 index 0000000000..77af2aa7eb --- /dev/null +++ b/cypress/tests/core/basic/logout.js @@ -0,0 +1,20 @@ +import { ploneAuth } from '../../../support/constants'; + +describe('Logout Tests', () => { + beforeEach(() => { + cy.visit('/'); + cy.contains('Log in').click(); + const user = ploneAuth[0]; + const password = ploneAuth[1]; + + cy.get('#login').type(user).should('have.value', user); + cy.get('#password').type(password).should('have.value', password); + cy.get('#login-form-submit').click(); + cy.get('body').should('have.class', 'has-toolbar'); + }); + it('As registered user I can logout', function () { + cy.get('#toolbar-personal').click(); + cy.get('#toolbar-logout').click(); + cy.getCookie('auth_key').should('not.exist'); + }); +}); diff --git a/cypress/tests/core/basic/view.js b/cypress/tests/core/basic/view.js new file mode 100644 index 0000000000..00cc061e25 --- /dev/null +++ b/cypress/tests/core/basic/view.js @@ -0,0 +1,55 @@ +describe('Add Content Tests', () => { + beforeEach(() => { + cy.intercept('GET', `/**/*?expand*`).as('content'); + // give a logged in editor and the site root + cy.autologin(); + cy.visit('/'); + cy.wait('@content'); + }); + + it('As editor I can change the view to Listing View', function () { + + cy.visit('/events'); + cy.get('#toolbar-more').click(); + cy.findByText('Listing view').click(); + cy.findByText('Album view').click(); + cy.visit('/events'); + cy.wait('@content'); + cy.wait(2000); + cy.get('main').contains('Event').should('be.visible'); + }); + + it('As editor I can change the view to Summary View', function () { + + cy.visit('/events'); + cy.get('#toolbar-more').click(); + cy.findByText('Listing view').click(); + cy.findByText('Summary view').click(); + cy.visit('/events'); + cy.wait('@content'); + cy.wait(2000); + cy.get('main').contains('Event').should('be.visible'); + }); + it('As editor I can change the view to Tabular View', function () { + + cy.visit('/events'); + cy.get('#toolbar-more').click(); + cy.findByText('Listing view').click(); + cy.findByText('Tabular view').click(); + cy.visit('/events'); + cy.wait('@content'); + cy.wait(2000); + cy.get('main').contains('Event').should('be.visible'); + }); + it('As editor I can change the view to Album View', function () { + + cy.visit('/events'); + cy.get('#toolbar-more').click(); + cy.findByText('Listing view').click(); + cy.visit('/events'); + cy.wait('@content'); + cy.wait(2000); + cy.get('main').contains('Event').should('be.visible'); + }); + }); + \ No newline at end of file diff --git a/cypress/tests/core/blocks/blocks-search.js b/cypress/tests/core/blocks/blocks-search.js index 055d9b7948..d9157567d7 100644 --- a/cypress/tests/core/blocks/blocks-search.js +++ b/cypress/tests/core/blocks/blocks-search.js @@ -1,4 +1,5 @@ describe('Search Block Tests', () => { + var results_number = 3; beforeEach(() => { cy.intercept('GET', `/**/*?expand*`).as('content'); cy.intercept('GET', '/**/Document').as('schema'); @@ -91,6 +92,12 @@ describe('Search Block Tests', () => { cy.wait(500); + // test search results number + cy.get('.search-details').should( + 'contain', + `Search results: ${results_number}`, + ); + // test if type facet works cy.get('.block.search .facets > .facet .entries > .entry label') .contains('Event') @@ -158,6 +165,12 @@ describe('Search Block Tests', () => { cy.get('#toolbar-save > .icon').click(); cy.wait(500); + + // test search results number + cy.get('.search-details').should( + 'contain', + `Search results: ${results_number}`, + ); }); it('Search block - test live searchbox', () => { @@ -201,6 +214,13 @@ describe('Search Block Tests', () => { cy.wait('@content'); cy.wait(500); + + // test search results number + cy.get('.search-details').should( + 'contain', + `Search results: ${results_number}`, + ); + // test searching for Event cy.get('.search-wrapper .search-input input').focus().type('Event'); cy.get('#page-document .listing-item:first-of-type a').should( @@ -237,6 +257,12 @@ describe('Search Block Tests', () => { ); cy.url().should('not.contain', '%22SearchableText%22'); + // test search results number + cy.get('.search-details').should( + 'contain', + `Search results: ${results_number}`, + ); + // test searching for Event cy.get('.search-wrapper .search-input input').focus().type('Event'); cy.get('#page-document .listing-item:first-of-type a').should( @@ -253,6 +279,9 @@ describe('Search Block Tests', () => { '%7B%22i%22%3A%22SearchableText%22%2C%22o%22%3A%22paqo.string.contains%22%2C%22v%22%3A%22Event%22%7D', ); + // test search results number + cy.get('.search-details').should('contain', 'Search results: 1'); + // test removing one char cy.get('.search-wrapper .search-input input').focus().type('{backspace}'); cy.get('.search-results-count-sort .search-details em') @@ -319,6 +348,12 @@ describe('Search Block Tests', () => { cy.wait(500); + // test search results number + cy.get('.search-details').should( + 'contain', + `Search results: ${results_number}`, + ); + // test searching for Event cy.get('.search-wrapper .search-input input').focus().type('Event'); cy.get('.search-wrapper > .ui.button').click(); @@ -337,6 +372,9 @@ describe('Search Block Tests', () => { '%7B%22i%22%3A%22SearchableText%22%2C%22o%22%3A%22paqo.string.contains%22%2C%22v%22%3A%22Event%22%7D', ); + // test search results number + cy.get('.search-details').should('contain', 'Search results: 1'); + // test removing one char cy.get('.search-wrapper .search-input input').focus().type('{backspace}'); cy.get('.search-wrapper > .ui.button').click(); @@ -359,6 +397,12 @@ describe('Search Block Tests', () => { ); cy.url().should('not.contain', '%22SearchableText%22'); + // test search results number + cy.get('.search-details').should( + 'contain', + `Search results: ${results_number}`, + ); + // test searching for Event cy.get('.search-wrapper .search-input input').focus().type('Event'); cy.get('.search-wrapper > .ui.button').click(); @@ -376,6 +420,9 @@ describe('Search Block Tests', () => { '%7B%22i%22%3A%22SearchableText%22%2C%22o%22%3A%22paqo.string.contains%22%2C%22v%22%3A%22Event%22%7D', ); + // test search results number + cy.get('.search-details').should('contain', 'Search results: 1'); + // test removing one char cy.get('.search-wrapper .search-input input').focus().type('{backspace}'); cy.get('.search-wrapper > .ui.button').click(); @@ -397,5 +444,11 @@ describe('Search Block Tests', () => { 'Searched for:', ); cy.url().should('not.contain', '%22SearchableText%22'); + + // test search results number + cy.get('.search-details').should( + 'contain', + `Search results: ${results_number}`, + ); }); }); diff --git a/docs/source/addons/i18n.md b/docs/source/addons/i18n.md index 2785521f86..8e904fd5aa 100644 --- a/docs/source/addons/i18n.md +++ b/docs/source/addons/i18n.md @@ -31,4 +31,7 @@ In the context of your project, run `yarn i18n` to merge the add-on translations ## Override translations -The workflow allows you to override translations from your project scope, so the project translations "always win". +If you have multiple add-ons installed in your project, the translations are loaded in the order your add-ons are listed in `package.json`. +If two add-ons provide different translations for the same message, then the last defined add-on wins. + +When running `yarn i18n` in the context of your project, the project's own locales are processed last and can override translations from any add-on. diff --git a/docs/source/conf.py b/docs/source/conf.py index 679833e9a9..e5d0610558 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -94,6 +94,7 @@ r"https://github.com/plone/plone.rest#cors", r"https://github.com/plone/plone.volto/blob/6f5382c74f668935527e962490b81cb72bf3bc94/src/kitconcept/volto/upgrades.py#L6-L54", r"https://github.com/plone/volto/issues/new/choose", + r"https://github.com/plone/volto/blob/6fd62cb2860bc7cf3cb7c36ea86bfd8bd03247d9/src/components/manage/Form/Field.jsx#L112", r"https://github.com/tc39/proposals/blob/HEAD/finished-proposals.md#finished-proposals", ] linkcheck_anchors = True diff --git a/locales/ca/LC_MESSAGES/volto.po b/locales/ca/LC_MESSAGES/volto.po index efbdaece1a..3538b2a89d 100644 --- a/locales/ca/LC_MESSAGES/volto.po +++ b/locales/ca/LC_MESSAGES/volto.po @@ -4640,7 +4640,7 @@ msgstr "a" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "[mes] [dia], [any]" +msgstr "[month] [day], [year]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/locales/de/LC_MESSAGES/volto.po b/locales/de/LC_MESSAGES/volto.po index bad1f80b7f..977225a343 100644 --- a/locales/de/LC_MESSAGES/volto.po +++ b/locales/de/LC_MESSAGES/volto.po @@ -4637,7 +4637,7 @@ msgstr "Regel AT" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "Regel Datumsformat" +msgstr "[day] [month] [year]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/locales/es/LC_MESSAGES/volto.po b/locales/es/LC_MESSAGES/volto.po index 377c7433f3..5f8187240d 100644 --- a/locales/es/LC_MESSAGES/volto.po +++ b/locales/es/LC_MESSAGES/volto.po @@ -1,13 +1,13 @@ # Gettext Message File for Plone # Translators: -# Leonardo J. Caballero G. , 2019, 2022. +# Leonardo J. Caballero G. , 2019, 2022, 2023. # Mikel Larreategi , 2021, 2022. msgid "" msgstr "" "Project-Id-Version: Plone\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-12-03 03:20-0400\n" -"PO-Revision-Date: 2023-06-20 14:02-0400\n" +"PO-Revision-Date: 2023-06-26 12:13-0400\n" "Last-Translator: Leonardo J. Caballero G. \n" "Language: es\n" "Language-Team: ES \n" @@ -147,7 +147,7 @@ msgstr "Añadir bloque" #: components/manage/Blocks/Container/NewBlockAddButton # defaultMessage: Add block in position {index} msgid "Add block in position {index}" -msgstr "" +msgstr "Añadir bloque en posición {index}" #: helpers/MessageLabels/MessageLabels # defaultMessage: Add block… @@ -177,7 +177,7 @@ msgstr "Añadir fecha" #: components/manage/Blocks/Container/SimpleContainerToolbar # defaultMessage: Add element to container msgid "Add element to container" -msgstr "" +msgstr "Añadir elemento al contenedor" #: components/manage/Widgets/SchemaWidget # defaultMessage: Add field @@ -745,7 +745,7 @@ msgstr "Elementos contenidos" #: components/manage/Blocks/Container/SimpleContainerToolbar # defaultMessage: Container settings msgid "Container settings" -msgstr "" +msgstr "Ajustes del contenedor" #: components/manage/Controlpanels/Controlpanels # defaultMessage: Content @@ -776,7 +776,7 @@ msgstr "Reglas de contenido de las carpetas principales" #: components/manage/LinksToItem/LinksToItem # defaultMessage: Content that links to or references {title} msgid "Content that links to or references {title}" -msgstr "" +msgstr "Contenido que enlaza o hace referencia a {title}" #: components/manage/Controlpanels/ContentTypes # defaultMessage: Content type created @@ -1311,7 +1311,7 @@ msgstr "Introduzca su nombre de usuario para verificar." #: components/manage/Blocks/ToC/Schema # defaultMessage: Entries msgid "Entries" -msgstr "" +msgstr "Entradas" #: components/manage/Add/Add #: components/manage/Controlpanels/AddonsControlpanel @@ -1563,7 +1563,7 @@ msgstr "Bloque embebido de Google Maps" #: components/manage/Blocks/Grid/schema # defaultMessage: Grid msgid "Grid" -msgstr "" +msgstr "Cuadrícula" #: components/manage/Sharing/Sharing # defaultMessage: Group @@ -1638,7 +1638,7 @@ msgstr "Ocultar filtros" #: components/manage/Blocks/ToC/Schema # defaultMessage: Hide title msgid "Hide title" -msgstr "" +msgstr "Ocultar título" #: components/manage/History/History #: components/manage/Toolbar/More @@ -1949,7 +1949,7 @@ msgstr "Enlace" #: helpers/MessageLabels/MessageLabels # defaultMessage: Link copied to clipboard msgid "Link copied to clipboard" -msgstr "" +msgstr "Enlace copiado al portapapeles" #: components/manage/Blocks/HeroImageLeft/schema #: components/manage/Blocks/Listing/schema @@ -1965,7 +1965,7 @@ msgstr "Vista de redirección del enlace" #: components/manage/Blocks/Image/schema # defaultMessage: Link settings msgid "Link settings" -msgstr "" +msgstr "Configuración de enlace" #: components/manage/Blocks/HeroImageLeft/schema #: components/manage/Blocks/Listing/schema @@ -1989,13 +1989,13 @@ msgstr "Enlazar traducción de" #: components/manage/LinksToItem/LinksToItem # defaultMessage: Linking this item with hyperlink in text msgid "Linking this item with hyperlink in text" -msgstr "" +msgstr "Vincular este elemento con un hipervínculo en el texto" #: components/manage/LinksToItem/LinksToItem #: components/manage/Toolbar/More # defaultMessage: Links and references msgid "Links and references" -msgstr "" +msgstr "Enlaces y referencias" #: components/manage/Blocks/Listing/schema # defaultMessage: Listing @@ -2332,7 +2332,7 @@ msgstr "No se han seleccionado elementos" #: components/manage/LinksToItem/LinksToItem # defaultMessage: No links to this item found. msgid "No links to this item found." -msgstr "" +msgstr "No se encontraron enlaces a este elemento." #: components/manage/Blocks/Maps/MapsSidebar # defaultMessage: No map selected @@ -2460,7 +2460,7 @@ msgstr "Abrir buscador de objetos" #: components/manage/Blocks/ToC/Schema # defaultMessage: Ordered msgid "Ordered" -msgstr "" +msgstr "Ordenado" #: components/manage/Blocks/LeadImage/LeadImageSidebar # defaultMessage: Origin @@ -2470,7 +2470,7 @@ msgstr "Origen" #: components/manage/LinksToItem/LinksToItem # defaultMessage: Overview of relations of all content items msgid "Overview of relations of all content items" -msgstr "" +msgstr "Descripción general de las relaciones de todos los elementos de contenido." #: components/manage/Toolbar/Toolbar # defaultMessage: Page @@ -2719,12 +2719,12 @@ msgstr "Reducir complejidad" #: components/manage/LinksToItem/LinksToItem # defaultMessage: Referencing this item as related item msgid "Referencing this item as related item" -msgstr "" +msgstr "Hacer referencia a este elemento como elemento relacionado" #: components/manage/LinksToItem/LinksToItem # defaultMessage: Referencing this item with {relationship} msgid "Referencing this item with {relationship}" -msgstr "" +msgstr "Hacer referencia a este elemento con {relationship}" #: components/theme/Anontools/Anontools #: components/theme/Login/Login @@ -2774,7 +2774,7 @@ msgstr "Eliminar" #: components/manage/Blocks/Container/EditBlockWrapper # defaultMessage: Remove element {index} msgid "Remove element {index}" -msgstr "" +msgstr "Eliminar elemento {index}" #: components/manage/Widgets/ObjectListWidget # defaultMessage: Remove item @@ -2864,7 +2864,7 @@ msgstr "Un campo requerido esta sin tomar en cuenta." #: components/manage/Blocks/Container/EditBlockWrapper # defaultMessage: Reset element {index} msgid "Reset element {index}" -msgstr "" +msgstr "Restablecer elemento {index}" #: components/manage/Widgets/VocabularyTermsWidget # defaultMessage: Reset title @@ -3165,7 +3165,7 @@ msgstr "Enviar un correo de confirmación con un enlace para establecer la contr #: components/theme/Error/ServerError # defaultMessage: Server Error msgid "Server Error" -msgstr "" +msgstr "Error del Servidor" #: components/theme/PasswordReset/PasswordReset # defaultMessage: Set my password @@ -3398,7 +3398,7 @@ msgstr "Estado" #: components/manage/Blocks/ToC/Schema # defaultMessage: Sticky msgid "Sticky" -msgstr "" +msgstr "Fija" #: components/manage/Multilingual/CompareLanguages # defaultMessage: Stop compare @@ -4124,7 +4124,7 @@ msgstr "Disculpe las molestias, la página a la que está intentando acceder no #: components/theme/Error/ServerError # defaultMessage: We apologize for the inconvenience, but there was an unexpected error on the server. msgid "We apologize for the inconvenience, but there was an unexpected error on the server." -msgstr "" +msgstr "Disculpe las molestias, pero se ha producido un error inesperado en el servidor." #: components/theme/Forbidden/Forbidden # defaultMessage: We apologize for the inconvenience, but you don't have permissions on this resource. @@ -4323,12 +4323,12 @@ msgstr "Casilla de verificación" #: components/manage/Blocks/Grid/templates # defaultMessage: column msgid "column" -msgstr "" +msgstr "columna" #: components/manage/Blocks/Grid/templates # defaultMessage: columns msgid "columns" -msgstr "" +msgstr "columnas" #: config/Blocks # defaultMessage: Common @@ -4343,7 +4343,7 @@ msgstr "Comparar con el idioma" #: components/manage/Controlpanels/Relations/BrokenRelations # defaultMessage: {countofrelation} broken {countofrelation, plural, one {relation} other {relations}} of type {typeofrelation} msgid "countBrokenRelations" -msgstr "" +msgstr "{countofrelation} roto {countofrelation, plural, one {relation} other {relations}} de tipo {typeofrelation}" #: config/Blocks # defaultMessage: Date Range @@ -4438,7 +4438,7 @@ msgstr "vaciar intIds y reconstruir relaciones" #: helpers/MessageLabels/MessageLabels # defaultMessage:
  • Regenerate intIds (tokens of relations in relation catalog)
  • Rebuild relations

Check the log for details!

Warning: If you have add-ons relying on intIds, you should not flush them.

msgid "flushAndRebuildRelationsHints" -msgstr "" +msgstr "
  • Regenerar intIds (tokens de relaciones en el catálogo de relaciones)
  • Reconstruir relaciones

¡Consulte el registro para obtener más detalles!

Advertencia: Si tiene complementos que dependen de intIds, no debería eliminarlos.

" #: components/manage/Blocks/Teaser/schema # defaultMessage: Head title @@ -4468,12 +4468,12 @@ msgstr "Imagen" #: components/manage/Blocks/Image/ImageSidebar # defaultMessage: Clear image msgid "image_block_clear" -msgstr "" +msgstr "Limpiar imagen" #: components/manage/Blocks/Image/ImageSidebar # defaultMessage: Image preview msgid "image_block_preview" -msgstr "" +msgstr "Vista previa de la imagen" #: helpers/MessageLabels/MessageLabels # defaultMessage: Input must be integer @@ -4642,7 +4642,7 @@ msgstr "a las" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "formato de fecha" +msgstr "[day]/[month]/[year]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/locales/fr/LC_MESSAGES/volto.po b/locales/fr/LC_MESSAGES/volto.po index e1e7e38ece..3ae148bbf9 100644 --- a/locales/fr/LC_MESSAGES/volto.po +++ b/locales/fr/LC_MESSAGES/volto.po @@ -4648,7 +4648,7 @@ msgstr "à" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "[mois] [jour], [année]" +msgstr "[month] [day], [year]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/locales/nl/LC_MESSAGES/volto.po b/locales/nl/LC_MESSAGES/volto.po index 145dca15fe..d8c1028fb9 100644 --- a/locales/nl/LC_MESSAGES/volto.po +++ b/locales/nl/LC_MESSAGES/volto.po @@ -4650,7 +4650,7 @@ msgstr "" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "" +msgstr "[month] [day], [year]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/locales/pt/LC_MESSAGES/volto.po b/locales/pt/LC_MESSAGES/volto.po index 4e83da9f26..3c9373c837 100644 --- a/locales/pt/LC_MESSAGES/volto.po +++ b/locales/pt/LC_MESSAGES/volto.po @@ -4639,7 +4639,7 @@ msgstr "" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "" +msgstr "[day] de [month] de [year]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/locales/ro/LC_MESSAGES/volto.po b/locales/ro/LC_MESSAGES/volto.po index 6cf8926163..d5812dc14a 100644 --- a/locales/ro/LC_MESSAGES/volto.po +++ b/locales/ro/LC_MESSAGES/volto.po @@ -4631,7 +4631,7 @@ msgstr "La" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "" +msgstr "[year]-[month]-[day]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/locales/zh_CN/LC_MESSAGES/volto.po b/locales/zh_CN/LC_MESSAGES/volto.po index 2f988fbb71..2be1957f98 100644 --- a/locales/zh_CN/LC_MESSAGES/volto.po +++ b/locales/zh_CN/LC_MESSAGES/volto.po @@ -4637,7 +4637,7 @@ msgstr "" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: [month] [day], [year] msgid "rrule_dateFormat" -msgstr "" +msgstr "[year]-[month]-[day]" #: components/manage/Widgets/RecurrenceWidget/Utils # defaultMessage: day diff --git a/news/1190.internal b/news/1190.internal deleted file mode 100644 index e8c73c5d56..0000000000 --- a/news/1190.internal +++ /dev/null @@ -1 +0,0 @@ -Improved spellcheck to keep spellings consistent. @chirayu-humar \ No newline at end of file diff --git a/news/3250.bugfix b/news/3250.bugfix new file mode 100644 index 0000000000..4f41d37c73 --- /dev/null +++ b/news/3250.bugfix @@ -0,0 +1 @@ +Fix for responsive error in the login page when the width of the screen decreases. @suman9893 \ No newline at end of file diff --git a/news/4503.bugfix b/news/4503.bugfix new file mode 100644 index 0000000000..9e78d10a74 --- /dev/null +++ b/news/4503.bugfix @@ -0,0 +1 @@ +fix : RecursiveWidget is incorrectly translated. @suman9893 \ No newline at end of file diff --git a/news/5031.bugfix b/news/5031.bugfix deleted file mode 100644 index b0fa16e6e0..0000000000 --- a/news/5031.bugfix +++ /dev/null @@ -1 +0,0 @@ -Allow a user to register when they use an email address as their username. [#5031](https://github.com/plone/volto/issues/5031) @mehedikhan72 \ No newline at end of file diff --git a/news/5041.breaking b/news/5041.breaking deleted file mode 100644 index 678ed5f515..0000000000 --- a/news/5041.breaking +++ /dev/null @@ -1,2 +0,0 @@ -Spin off relation stats action. Get relation stats with getRelationStats() instead of with queryRelations(). @ksuess -Refactor relations actions: slightly change the shape of the redux state for `queryRelations` to follow common signatures. @ksuess \ No newline at end of file diff --git a/news/5075.bugfix b/news/5075.bugfix deleted file mode 100644 index 345815ecfb..0000000000 --- a/news/5075.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix i18n for link settings fieldset in the image block @iRohitSingh \ No newline at end of file diff --git a/news/5076.bugfix b/news/5076.bugfix deleted file mode 100644 index 66faa618e8..0000000000 --- a/news/5076.bugfix +++ /dev/null @@ -1 +0,0 @@ -Prevent caching the outdated browser message in a shared cache. @davisagli diff --git a/news/5084.documentation b/news/5084.documentation deleted file mode 100644 index b15db05d58..0000000000 --- a/news/5084.documentation +++ /dev/null @@ -1 +0,0 @@ -Update links to contributing. @stevepiercy diff --git a/news/5095.documentation b/news/5095.documentation deleted file mode 100644 index 24bcd364a7..0000000000 --- a/news/5095.documentation +++ /dev/null @@ -1 +0,0 @@ -Accept `plone` and `volto` in labels with janky regex. Include Vale styles directory for checking spelling and styles. @stevepiercy diff --git a/news/5106.bugfix b/news/5106.bugfix deleted file mode 100644 index 69b57094e6..0000000000 --- a/news/5106.bugfix +++ /dev/null @@ -1,2 +0,0 @@ -For folders inside navigation roots, properly fetch navigation from the -navroot, rather then the site root @tiberiuichim diff --git a/news/5107.bugfix b/news/5107.bugfix deleted file mode 100644 index 0c1985b4d2..0000000000 --- a/news/5107.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix uncached case when the widget is slate on diff @dobri1408 diff --git a/news/5120.feature b/news/5120.feature new file mode 100644 index 0000000000..b06da11583 --- /dev/null +++ b/news/5120.feature @@ -0,0 +1 @@ +Updated Spanish translation @macagua \ No newline at end of file diff --git a/news/5131.documentation b/news/5131.documentation new file mode 100644 index 0000000000..26e775b5ca --- /dev/null +++ b/news/5131.documentation @@ -0,0 +1 @@ +Fix linkcheckbroken 301 redirect to https://www.dlr.de/de @stevepiercy diff --git a/news/5132.bugfix b/news/5132.bugfix new file mode 100644 index 0000000000..cbfc7bcd60 --- /dev/null +++ b/news/5132.bugfix @@ -0,0 +1 @@ +Fix storybook config for project generator. Add support for SCSS, upgrade to webpack 5 in there as well. @sneridagh diff --git a/news/5146.feature b/news/5146.feature new file mode 100644 index 0000000000..105a9b9e0c --- /dev/null +++ b/news/5146.feature @@ -0,0 +1 @@ +(feat): Update toc block entries @dobri1408 diff --git a/news/5149.feature b/news/5149.feature new file mode 100644 index 0000000000..8313f839f9 --- /dev/null +++ b/news/5149.feature @@ -0,0 +1 @@ +Views cypress test -@Tishasoumya \ No newline at end of file diff --git a/news/5151.bugfix b/news/5151.bugfix new file mode 100644 index 0000000000..c9732888fe --- /dev/null +++ b/news/5151.bugfix @@ -0,0 +1 @@ +Don't show ``No value`` option in SelectWidget and ArrayWidget if default value is 0. @wesleybl diff --git a/news/5154.bugfix b/news/5154.bugfix new file mode 100644 index 0000000000..3e202086df --- /dev/null +++ b/news/5154.bugfix @@ -0,0 +1 @@ +Fix SelectWidget throwing error when editing a recently created content. @iFlameing \ No newline at end of file diff --git a/news/5158.bugfix b/news/5158.bugfix new file mode 100644 index 0000000000..18f14268ea --- /dev/null +++ b/news/5158.bugfix @@ -0,0 +1 @@ +Fix editing layout for blocks using schema enhancers. @iFlameing, @davisagli \ No newline at end of file diff --git a/news/5161.bugfix b/news/5161.bugfix new file mode 100644 index 0000000000..e43615cc6e --- /dev/null +++ b/news/5161.bugfix @@ -0,0 +1 @@ +Fix ContentRules add and edit forms for languages other than English. @ericof diff --git a/news/5171.bugfix b/news/5171.bugfix new file mode 100644 index 0000000000..545a94c8ea --- /dev/null +++ b/news/5171.bugfix @@ -0,0 +1 @@ +Fix search block search results number @ionlizarazu \ No newline at end of file diff --git a/news/5171.feature b/news/5171.feature new file mode 100644 index 0000000000..0caad91658 --- /dev/null +++ b/news/5171.feature @@ -0,0 +1 @@ +Cypress test to test if 'Search results: number' text is present @ionlizarazu \ No newline at end of file diff --git a/news/5514.bugfix b/news/5514.bugfix deleted file mode 100644 index e4b7515657..0000000000 --- a/news/5514.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix inherit checkbox in sharing view @sneridagh diff --git a/package.json b/package.json index 822d15e5a6..bc9ecfc0c9 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ } ], "license": "MIT", - "version": "17.0.0-alpha.24", + "version": "17.0.0-alpha.25", "repository": { "type": "git", "url": "git@github.com:plone/volto.git" diff --git a/packages/generator-volto/generators/app/templates/.storybook/main.js b/packages/generator-volto/generators/app/templates/.storybook/main.js index 3f0ea324be..4f4efc7d1a 100644 --- a/packages/generator-volto/generators/app/templates/.storybook/main.js +++ b/packages/generator-volto/generators/app/templates/.storybook/main.js @@ -6,6 +6,7 @@ const fileLoaderFinder = makeLoaderFinder('file-loader'); const projectRootPath = path.resolve('.'); const lessPlugin = require('@plone/volto/webpack-plugins/webpack-less-plugin'); +const scssPlugin = require('razzle-plugin-scss'); const createConfig = require('../node_modules/razzle/config/createConfigAsync.js'); const razzleConfig = require(path.join(projectRootPath, 'razzle.config.js')); @@ -20,10 +21,17 @@ const SVGLOADER = { loader: 'svgo-loader', options: { plugins: [ - { removeTitle: true }, - { convertPathData: false }, - { removeUselessStrokeAndFill: true }, - { removeViewBox: false }, + { + name: 'preset-default', + params: { + overrides: { + convertPathData: false, + removeViewBox: false, + }, + }, + }, + 'removeTitle', + 'removeUselessStrokeAndFill', ], }, }, @@ -55,6 +63,9 @@ const defaultRazzleOptions = { }; module.exports = { + core: { + builder: 'webpack5', + }, stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], addons: [ '@storybook/addon-links', @@ -93,11 +104,20 @@ module.exports = { options: {}, }); - // putting SVG loader on top, fix the fileloader manually (Volto plugin does not - // work) since it needs to go first + config = scssPlugin.modifyWebpackConfig({ + env: { target: 'web', dev: 'dev' }, + webpackConfig: config, + webpackObject: webpack, + options: { razzleOptions: {} }, + }); + + // Put the SVG loader on top and prevent the asset/resource rule + // from processing the app's SVGs config.module.rules.unshift(SVGLOADER); - const fileLoader = config.module.rules.find(fileLoaderFinder); - fileLoader.exclude = [/\.(config|variables|overrides)$/, /icons\/.*\.svg$/]; + const fileLoaderRule = config.module.rules.find((rule) => + rule.test.test('.svg'), + ); + fileLoaderRule.exclude = /icons\/.*\.svg$/; config.plugins.unshift( new webpack.DefinePlugin({ @@ -112,6 +132,7 @@ module.exports = { resolve: { ...config.resolve, alias: { ...config.resolve.alias, ...baseConfig.resolve.alias }, + fallback: { ...config.resolve.fallback, zlib: false }, }, }; diff --git a/packages/generator-volto/generators/app/templates/package.json.tpl b/packages/generator-volto/generators/app/templates/package.json.tpl index 648853b627..5bbb511963 100644 --- a/packages/generator-volto/generators/app/templates/package.json.tpl +++ b/packages/generator-volto/generators/app/templates/package.json.tpl @@ -147,6 +147,8 @@ "@storybook/addon-controls": "6.3.0", "@storybook/addon-essentials": "^6.3.0", "@storybook/addon-links": "^6.3.0", + "@storybook/builder-webpack5": "^6.5.15", + "@storybook/manager-webpack5": "^6.5.15", "@storybook/react": "^6.3.0", "razzle": "4.2.18", "stylelint": "14.0.1", diff --git a/packages/scripts/i18n.cjs b/packages/scripts/i18n.cjs index b1023c4538..d3088bac5f 100755 --- a/packages/scripts/i18n.cjs +++ b/packages/scripts/i18n.cjs @@ -186,8 +186,8 @@ function poToJson({ registry, addonMode }) { const addonItems = Pofile.parse( fs.readFileSync(addonlocale, 'utf8'), ).items; - items = [...addonItems, ...items]; - mergeMessages(result, items, lang); + + mergeMessages(result, addonItems, lang); if (require.main === module) { // We only log it if called as script console.log(`Merging ${addon} locales for ${lang}`); diff --git a/packages/volto-slate/package.json b/packages/volto-slate/package.json index 2e389fc591..4304d95521 100644 --- a/packages/volto-slate/package.json +++ b/packages/volto-slate/package.json @@ -1,6 +1,6 @@ { "name": "@plone/volto-slate", - "version": "17.0.0-alpha.24", + "version": "17.0.0-alpha.25", "description": "Slate.js integration with Volto", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", diff --git a/src/components/manage/Blocks/Block/Settings.jsx b/src/components/manage/Blocks/Block/Settings.jsx index 963011378f..c9b4503c5e 100644 --- a/src/components/manage/Blocks/Block/Settings.jsx +++ b/src/components/manage/Blocks/Block/Settings.jsx @@ -14,7 +14,9 @@ const Settings = ({ data, block, onChangeBlock, schema }) => { [id]: value, }); }} + onChangeBlock={onChangeBlock} formData={data} + applySchemaEnhancers={false} /> ); }; diff --git a/src/components/manage/Blocks/Block/Settings.test.jsx b/src/components/manage/Blocks/Block/Settings.test.jsx new file mode 100644 index 0000000000..04deeeecdf --- /dev/null +++ b/src/components/manage/Blocks/Block/Settings.test.jsx @@ -0,0 +1,90 @@ +import React from 'react'; +import Settings from './Settings'; +import { render } from '@testing-library/react'; +import '@testing-library/jest-dom/extend-expect'; +import configureStore from 'redux-mock-store'; +import config from '@plone/volto/registry'; +import { Provider } from 'react-intl-redux'; + +const mockStore = configureStore(); + +const withStateManagement = (Component) => ({ ...props }) => { + const [formData, onChangeFormData] = React.useState(props.formData || {}); + const onChangeField = (id, value) => { + onChangeFormData({ ...formData, [id]: value }); + }; + + // NOTE: onChangeBlock here is not "really" implemented + + return ( + onChangeFormData(data)} + formData={formData} + /> + ); +}; + +beforeAll(() => { + config.widgets = { + id: {}, + widget: {}, + vocabulary: {}, + choices: (props) => ( +
{JSON.stringify(props.choices)}
+ ), + type: {}, + default: () =>
, + }; + + config.blocks.blocksConfig = { + ...config.blocks.blocksConfig, + + testBlock: { + id: 'testBlock', + variations: [ + { + id: 'default', + title: 'Default', + isDefault: true, + }, + { + id: 'extra', + title: 'Extra', + }, + ], + }, + }; +}); + +describe('Settings', () => { + it('renders block settings form without schema enhancers', () => { + const WrappedSettings = withStateManagement(Settings); + const store = mockStore({ + intl: { + locale: 'en', + messages: {}, + }, + }); + const testSchema = { + fieldsets: [{ title: 'Default', id: 'default', fields: [] }], + properties: {}, + required: [], + }; + const data = { + '@type': 'testBlock', + }; + const { container } = render( + + {}} + /> + , + ); + expect(container).toMatchSnapshot(); + }); +}); diff --git a/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap b/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap new file mode 100644 index 0000000000..d60a35d1da --- /dev/null +++ b/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Settings renders block settings form without schema enhancers 1`] = ` +
+
+
+
+
+
+
+`; diff --git a/src/components/manage/Blocks/Listing/withQuerystringResults.jsx b/src/components/manage/Blocks/Listing/withQuerystringResults.jsx index e725cb5d1b..6dd025769b 100644 --- a/src/components/manage/Blocks/Listing/withQuerystringResults.jsx +++ b/src/components/manage/Blocks/Listing/withQuerystringResults.jsx @@ -23,7 +23,7 @@ export default function withQuerystringResults(WrappedComponent) { } = props; const { settings } = config; const querystring = data.querystring || data; // For backwards compat with data saved before Blocks schema. Note, this is also how the Search block passes data to ListingBody - + const subrequestID = content?.UID ? `${content?.UID}-${id}` : id; const { b_size = settings.defaultPageSize } = querystring; // batchsize // save the path so it won't trigger dispatch on eager router location change @@ -52,31 +52,33 @@ export default function withQuerystringResults(WrappedComponent) { const folderItems = content?.is_folderish ? content.items : []; const hasQuery = querystring?.query?.length > 0; - const hasLoaded = hasQuery ? querystringResults?.[id]?.loaded : true; + const hasLoaded = hasQuery + ? querystringResults?.[subrequestID]?.loaded + : true; const listingItems = hasQuery - ? querystringResults?.[id]?.items || [] + ? querystringResults?.[subrequestID]?.items || [] : folderItems; const showAsFolderListing = !hasQuery && content?.items_total > b_size; const showAsQueryListing = - hasQuery && querystringResults?.[id]?.total > b_size; + hasQuery && querystringResults?.[subrequestID]?.total > b_size; const totalPages = showAsFolderListing ? Math.ceil(content.items_total / b_size) : showAsQueryListing - ? Math.ceil(querystringResults[id].total / b_size) + ? Math.ceil(querystringResults[subrequestID].total / b_size) : 0; const prevBatch = showAsFolderListing ? content.batching?.prev : showAsQueryListing - ? querystringResults[id].batching?.prev + ? querystringResults[subrequestID].batching?.prev : null; const nextBatch = showAsFolderListing ? content.batching?.next : showAsQueryListing - ? querystringResults[id].batching?.next + ? querystringResults[subrequestID].batching?.next : null; const isImageGallery = @@ -86,7 +88,12 @@ export default function withQuerystringResults(WrappedComponent) { useDeepCompareEffect(() => { if (hasQuery) { dispatch( - getQueryStringResults(initialPath, adaptedQuery, id, currentPage), + getQueryStringResults( + initialPath, + adaptedQuery, + subrequestID, + currentPage, + ), ); } else if (isImageGallery && !hasQuery) { // when used as image gallery, it doesn't need a query to list children @@ -104,7 +111,7 @@ export default function withQuerystringResults(WrappedComponent) { }, ], }, - id, + subrequestID, ), ); } else { @@ -113,7 +120,7 @@ export default function withQuerystringResults(WrappedComponent) { adaptedQueryRef.current = adaptedQuery; currentPageRef.current = currentPage; }, [ - id, + subrequestID, isImageGallery, adaptedQuery, hasQuery, @@ -126,7 +133,7 @@ export default function withQuerystringResults(WrappedComponent) { setCurrentPage(activePage)} - total={querystringResults?.[id]?.total} + total={querystringResults?.[subrequestID]?.total} batch_size={b_size} currentPage={currentPage} totalPages={totalPages} diff --git a/src/components/manage/Blocks/ToC/View.jsx b/src/components/manage/Blocks/ToC/View.jsx index a0cd337f53..2ba31d12a2 100644 --- a/src/components/manage/Blocks/ToC/View.jsx +++ b/src/components/manage/Blocks/ToC/View.jsx @@ -16,16 +16,79 @@ import { getBlocksLayoutFieldname, } from '@plone/volto/helpers'; +export const getBlocksTocEntries = (properties, tocData) => { + const blocksFieldName = getBlocksFieldname(properties); + const blocksLayoutFieldname = getBlocksLayoutFieldname(properties); + + const blocks = properties[blocksFieldName]; + const blocks_layout = properties[blocksLayoutFieldname]; + + const levels = + tocData.levels?.length > 0 + ? tocData.levels.map((l) => parseInt(l.slice(1))) + : [1, 2, 3, 4, 5, 6]; + let rootLevel = Infinity; + let blocksFormEntries = []; + let tocEntries = {}; + let tocEntriesLayout = []; + + blocks_layout.items.forEach((id) => { + const block = blocks[id]; + const blockConfig = config.blocks.blocksConfig[block['@type']]; + + if (!block || !blockConfig) { + return null; + } + if (!blockConfig.tocEntries && !blockConfig.tocEntry) { + return null; + } + + const blockTocEntry = blockConfig.tocEntry?.(block, tocData); + + const blockTocEntries = [ + ...(blockConfig.tocEntries?.(block, tocData) || + (blockTocEntry ? [blockTocEntry] : [])), + ]; + + blocksFormEntries = [...blocksFormEntries, ...blockTocEntries]; + + blockTocEntries.forEach((entry, index) => { + const i = `${id}-${index}`; + const level = entry[0]; + const title = entry[1]; + const items = []; + if (!level || !levels.includes(level)) return; + tocEntriesLayout.push(i); + tocEntries[i] = { + level, + title: title || block.plaintext, + items, + id: i, + }; + if (level < rootLevel) { + rootLevel = level; + } + }); + }); + + return { + rootLevel, + blocksFormEntries, + tocEntries, + tocEntriesLayout, + }; +}; + /** * View toc block class. * @class View * @extends Component */ const View = (props) => { - const { properties, data } = props; + const { data } = props; const { variation } = props; - const blocksFieldname = getBlocksFieldname(properties); - const blocksLayoutFieldname = getBlocksLayoutFieldname(properties); + const metadata = props.metadata || props.properties; + const blocksFieldname = getBlocksFieldname(metadata); const levels = React.useMemo( () => data.levels?.length > 0 @@ -34,14 +97,15 @@ const View = (props) => { [data], ); const tocEntries = React.useMemo(() => { - let rootLevel = Infinity; let entries = []; let prevEntry = {}; - let tocEntries = {}; - let tocEntriesLayout = []; + const { rootLevel, tocEntries, tocEntriesLayout } = getBlocksTocEntries( + metadata, + data, + ); - properties[blocksLayoutFieldname].items.forEach((id) => { - const block = properties[blocksFieldname][id]; + tocEntriesLayout.forEach((id) => { + const block = metadata[blocksFieldname][id]; if (typeof block === 'undefined') { return null; } @@ -50,6 +114,7 @@ const View = (props) => { block, data, ); + if (entry) { const level = entry[0]; const title = entry[1]; @@ -64,9 +129,6 @@ const View = (props) => { override_toc: block.override_toc, plaintext: block.plaintext, }; - if (level < rootLevel) { - rootLevel = level; - } } }); @@ -98,7 +160,7 @@ const View = (props) => { }); return entries; - }, [data, levels, properties, blocksFieldname, blocksLayoutFieldname]); + }, [data, levels, metadata, blocksFieldname]); const Renderer = variation?.view; return ( @@ -108,7 +170,7 @@ const View = (props) => { )} {Renderer ? ( - + ) : (
View extension not found
)} diff --git a/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx b/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx index 148a8d88e3..05769ec65c 100644 --- a/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +++ b/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx @@ -12,7 +12,9 @@ import { useHistory } from 'react-router-dom'; import AnchorLink from 'react-anchor-link-smooth-scroll'; import Slugger from 'github-slugger'; -const RenderListItems = ({ items, data, history }) => { +const RenderListItems = ({ items, data }) => { + const history = useHistory(); + return map(items, (item) => { const { id, level, title, override_toc, plaintext } = item; const slug = override_toc @@ -50,7 +52,6 @@ const RenderListItems = ({ items, data, history }) => { * @extends Component */ const View = ({ data, tocEntries }) => { - const history = useHistory(); return ( <> {data.title && !data.hide_title ? ( @@ -70,7 +71,7 @@ const View = ({ data, tocEntries }) => { bulleted={!data.ordered} as={data.ordered ? 'ol' : 'ul'} > - + ); diff --git a/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx b/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx new file mode 100644 index 0000000000..e037fceb85 --- /dev/null +++ b/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.test.jsx @@ -0,0 +1,44 @@ +import renderer from 'react-test-renderer'; +import configureStore from 'redux-mock-store'; +import { Provider } from 'react-intl-redux'; +import { MemoryRouter } from 'react-router-dom'; +import DefaultTocRenderer from './DefaultTocRenderer'; + +const mockStore = configureStore(); + +const data = { '@type': 'toc', variation: 'default' }; + +const tocEntries = [ + { + level: 2, + title: 'Hello this is a sample page', + items: [ + { + level: 3, + title: 'Test level 3', + items: [], + id: 'be612682-6df9-4a5e-b3a1-9dec5d82ae14', + parentId: '3a8bff13-3245-44f6-8a35-e0defef5898e', + }, + ], + id: '3a8bff13-3245-44f6-8a35-e0defef5898e', + }, +]; + +test('renders a default toc renderer component', () => { + const store = mockStore({ + intl: { + locale: 'en', + messages: {}, + }, + }); + const component = renderer.create( + + + + + , + ); + const json = component.toJSON(); + expect(json).toMatchSnapshot(); +}); diff --git a/src/components/manage/Blocks/ToC/variations/__snapshots__/DefaultTocRenderer.test.jsx.snap b/src/components/manage/Blocks/ToC/variations/__snapshots__/DefaultTocRenderer.test.jsx.snap new file mode 100644 index 0000000000..bccce4e4ae --- /dev/null +++ b/src/components/manage/Blocks/ToC/variations/__snapshots__/DefaultTocRenderer.test.jsx.snap @@ -0,0 +1,41 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders a default toc renderer component 1`] = ` +Array [ + "", + , +] +`; diff --git a/src/components/manage/Contents/Contents.jsx b/src/components/manage/Contents/Contents.jsx index 3b2801b599..920cbf1832 100644 --- a/src/components/manage/Contents/Contents.jsx +++ b/src/components/manage/Contents/Contents.jsx @@ -1334,6 +1334,9 @@ class Contents extends Component { as={Button} onClick={this.upload} className="upload" + aria-label={this.props.intl.formatMessage( + messages.upload, + )} >
`; -exports[`BlockDataForm should does not add variations to schema when unneeded 1`] = ` +exports[`BlockDataForm should not add variations to schema when explicitly disabled 1`] = `
`; -exports[`BlockDataForm should does not add variations when only one variation 1`] = ` +exports[`BlockDataForm should not add variations to schema when unneeded 1`] = ` +
+
+
+
+
+
+
+`; + +exports[`BlockDataForm should not add variations when only one variation 1`] = `
{ await waitFor(() => {}); expect(component.toJSON()).toMatchSnapshot(); }); + +test("No 'No value' option when default value is 0", async () => { + const store = mockStore({ + intl: { + locale: 'en', + messages: {}, + }, + }); + + const choices = [ + ['0', 'None'], + ['1', 'One'], + ]; + + const value = { + value: '0', + label: 'None', + }; + + const _default = 0; + + const { container } = render( + + {}} + onBlur={() => {}} + onClick={() => {}} + /> + , + ); + + fireEvent.mouseDown( + container.querySelector('.react-select__dropdown-indicator'), + { button: 0 }, + ); + expect(container).toMatchSnapshot(); +}); diff --git a/src/components/manage/Widgets/FormFieldWrapper.jsx b/src/components/manage/Widgets/FormFieldWrapper.jsx index 542dc0cd0f..5406ffbfcd 100644 --- a/src/components/manage/Widgets/FormFieldWrapper.jsx +++ b/src/components/manage/Widgets/FormFieldWrapper.jsx @@ -96,7 +96,7 @@ class FormFieldWrapper extends Component { {this.props.children} {map(error, (message) => ( -