diff --git a/oereb_client/static/src/component/responsible_office/responsible_office.jsx b/oereb_client/static/src/component/responsible_office/responsible_office.jsx index f0fdcdb2..5579631b 100644 --- a/oereb_client/static/src/component/responsible_office/responsible_office.jsx +++ b/oereb_client/static/src/component/responsible_office/responsible_office.jsx @@ -26,13 +26,22 @@ const OerebResponsibleOffice = function (props) { const officeElements = offices.map((office, key) => { const localizedName = getLocalizedText(office['Name'], currentLanguage, defaultLanguage); const localizedUrl = getLocalizedText(office['OfficeAtWeb'], currentLanguage, defaultLanguage); - return ( -
- + if (localizedUrl === null) { + return ( +
{localizedName} - -
- ); + + ); + } + else { + return ( +
+ + {localizedName} + +
+ ); + } }); return ( diff --git a/oereb_client/static/src/util/language.js b/oereb_client/static/src/util/language.js index 18861f30..4e594364 100644 --- a/oereb_client/static/src/util/language.js +++ b/oereb_client/static/src/util/language.js @@ -1,5 +1,7 @@ +import {isArray} from "lodash"; + export const getLocalizedText = function (multilingualText, language, defaultLanguage) { - if (multilingualText.length > 0) { + if (isArray(multilingualText) && multilingualText.length > 0) { let defaultValue = null; for (let i = 0; i < multilingualText.length; i++) { if (multilingualText[i]['Language'] === language) { @@ -18,7 +20,7 @@ export const getLocalizedText = function (multilingualText, language, defaultLan }; export const getLocalizedUrl = function (multilingualUrl, language, defaultLanguage) { - if (multilingualUrl.length > 0) { + if (isArray(multilingualUrl) && multilingualUrl.length > 0) { let defaultValue = null; for (let i = 0; i < multilingualUrl.length; i++) { if (multilingualUrl[i]['Language'] === language) { diff --git a/test/js/component/app/__snapshots__/app.test.js.snap b/test/js/component/app/__snapshots__/app.test.js.snap deleted file mode 100644 index d8e4e60d..00000000 --- a/test/js/component/app/__snapshots__/app.test.js.snap +++ /dev/null @@ -1,22 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`app component should render app element 1`] = ` - -
-
- Mocked Map -
-
- Mocked Information Panel -
-
- Mocked Extract -
-
- Mocked Menu -
-
-
-`; diff --git a/test/js/component/availability_layer/__snapshots__/availability_layer.test.js.snap b/test/js/component/availability_layer/__snapshots__/availability_layer.test.js.snap deleted file mode 100644 index 0fba85bb..00000000 --- a/test/js/component/availability_layer/__snapshots__/availability_layer.test.js.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`availability layer component should render availability layer element 1`] = ``; diff --git a/test/js/component/category/__snapshots__/category.test.js.snap b/test/js/component/category/__snapshots__/category.test.js.snap deleted file mode 100644 index 24738e3b..00000000 --- a/test/js/component/category/__snapshots__/category.test.js.snap +++ /dev/null @@ -1,310 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`category component should render category with and without restrictions 1`] = ` - -
-

- -

-
-
- Mocked topics with restrictions -
-
-
-
-

- -

-
-
- Mocked topics with restrictions -
-
-
-
-

- -

-
-
- Mocked topics without restrictions -
-
-
-
-`; - -exports[`category component should render category with and without restrictions 2`] = ` - -
-

- -

-
-
- Mocked topics with restrictions -
-
-
-
-

- -

-
-
- Mocked topics with restrictions -
-
-
-
-

- -

-
-
- Mocked topics without restrictions -
-
-
-
-`; - -exports[`category component should render category with and without restrictions 3`] = ` - -
-

- -

-
-
- Mocked topics with restrictions -
-
-
-
-

- -

-
-
- Mocked topics with restrictions -
-
-
-
-

- -

-
-
- Mocked topics without restrictions -
-
-
-
-`; diff --git a/test/js/component/documents/__snapshots__/documents.test.js.snap b/test/js/component/documents/__snapshots__/documents.test.js.snap deleted file mode 100644 index f94302b7..00000000 --- a/test/js/component/documents/__snapshots__/documents.test.js.snap +++ /dev/null @@ -1,186 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`documents component should render documents 1`] = ` - -
-
- extract.topic.document.legal_provisions -
-
- - Baugesetz, 3891.100 - - -
-
- - Revision Ortsplanung, 07.447 - - -
-
- extract.topic.document.laws -
-
- - Raumplanungsverordnung für den Kanton Graubünden (KRVO), BR 801.110 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (RPG), SR 700 - - -
-
- - Raumplanungsgesetz für den Kanton Graubünden (KRG), BR 801.100 - - -
-
- extract.topic.document.hints -
-
- - Guter Ratschlag - - -
-
- - Seht guter Ratschlag mit langem titel: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis venenatis posuere. Nunc sollicitudin fermentum bibendum. Nulla ut massa enim. Sed rhoncus euismod venenatis - - -
-
-
-`; diff --git a/test/js/component/external_viewer/__snapshots__/external_viewer.test.js.snap b/test/js/component/external_viewer/__snapshots__/external_viewer.test.js.snap deleted file mode 100644 index 08d54375..00000000 --- a/test/js/component/external_viewer/__snapshots__/external_viewer.test.js.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`external viewer component should not render button 1`] = ``; - -exports[`external viewer component should render button 1`] = ` - - - -`; diff --git a/test/js/component/extract/__snapshots__/extract.test.js.snap b/test/js/component/extract/__snapshots__/extract.test.js.snap deleted file mode 100644 index aebad190..00000000 --- a/test/js/component/extract/__snapshots__/extract.test.js.snap +++ /dev/null @@ -1,2687 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`extract component should render error message 1`] = ` - -
-
-

- -

-

- -  extract.error.title -

-

- extract.error.message -

-

- -

-

- extract.error.support.message -

-
- - Amt für Geoinformation - - -
- GIS-Fachstelle -
- -
- Mühlemattstrasse 36 -
- -
- 4410 Liestal -
- -
- -  061 552 56 73 -
- -
- -   - - support.gis@bl.ch - -
-
-
-
-
-`; - -exports[`extract component should render extract data 1`] = ` - -
-
-
-
- - -
-
- - - -
-
-
-
- Liegenschaft 70 extract.real_estate.at Oberwil (BL) -
-
-
- - extract.real_estate.egrid: - -
-
- CH1234 -
-
-
-
- - extract.real_estate.area: - -
-
- 35121 m² -
-
-
-
-
-

- -

-
-
-
-
-
- - Nutzungsplanung (kantonal/kommunal): Grundnutzung - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 101 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 63 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Nutzungsplanung (kantonal/kommunal): Überlagernde Elemente - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 3608 m - - 2 - - - - 10.3% -
- - - Belastet, untersuchungsbedürftig - - 2 - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 7824 m - - 2 - - - - 22.3% -
-
-
- extract.topic.document.legal_provisions -
-
- - Revision Ortsplanung, 07.447 - - -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (AltlV), SR 700 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Kataster der belasteten Standorte im Bereich der zivilen Flugplätze - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, keine schädlichen oder lästigen Einwirkungen zu erwarten - - 1 - -
-
-
- extract.topic.document.legal_provisions -
-
- - BL-Ditt-3-I-01 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Zivilluftfahrt BAZL - -
-
-
-
-
-
-
-
- - Kataster der belasteten Standorte im Bereich des öffentlichen Verkehrs - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 3608 m - - 2 - - - - 10.3% -
- - - Belastet, untersuchungsbedürftig - - 2 - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 7824 m - - 2 - - - - 22.3% -
- - - Belastet, untersuchungsbedürftig - - 101 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - Revision Ortsplanung, 07.447 - - -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (AltlV), SR 700 - - -
-
- extract.topic.document.hints -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 63 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Grundwasserschutzzonen - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Fassungsbereich (Zone S1) - - - 7824 m - - 2 - - - - 22.3% -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Statische Waldgrenzen - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 202 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - Baugesetz, 3891.100 - - -
-
- - Revision Ortsplanung, 07.447 - - -
-
- extract.topic.document.laws -
-
- - Raumplanungsverordnung für den Kanton Graubünden (KRVO), BR 801.110 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (RPG), SR 700 - - -
-
- - Raumplanungsgesetz für den Kanton Graubünden (KRG), BR 801.100 - - -
-
- extract.topic.document.hints -
-
- - Guter Ratschlag - - -
-
- - Seht guter Ratschlag mit langem titel: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis venenatis posuere. Nunc sollicitudin fermentum bibendum. Nulla ut massa enim. Sed rhoncus euismod venenatis - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
-
-
-
-

- -

-
-
-
    -
  • - Projektierungszonen Nationalstrassen -
  • -
  • - Projektierungszonen Eisenbahnanlagen -
  • -
  • - Baulinien Eisenbahnanlagen -
  • -
  • - Projektierungszonen Flughafenanlagen -
  • -
  • - Baulinien Flughafenanlagen -
  • -
  • - Sicherheitszonenplan -
  • -
  • - Kataster der belasteten Standorte -
  • -
  • - Grundwasserschutzareale -
  • -
  • - Lärmempfindlichkeitsstufen (in Nutzungszonen) -
  • -
  • - Waldabstandslinien -
  • -
-
-
-
-
-

- -

-
-
-
    -
  • - Baulinien Nationalstrassen -
  • -
  • - Kataster der belasteten Standorte im Bereich des Militärs -
  • -
-
-
-
-
-
-
-
-`; - -exports[`extract component should render loading message 1`] = ` - -
-
-

- -  extract.loading.message -

-
-
-
-`; diff --git a/test/js/component/information_panel/__snapshots__/information_panel.test.js.snap b/test/js/component/information_panel/__snapshots__/information_panel.test.js.snap deleted file mode 100644 index 3d4be81a..00000000 --- a/test/js/component/information_panel/__snapshots__/information_panel.test.js.snap +++ /dev/null @@ -1,977 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`information panel component should filter glossary results 1`] = ` - - - -`; - -exports[`information panel component should render disclaimer 1`] = ` - - - -`; - -exports[`information panel component should render general information 1`] = ` - - - -`; - -exports[`information panel component should render glossary 1`] = ` - - - -`; diff --git a/test/js/component/language/__snapshots__/language.test.js.snap b/test/js/component/language/__snapshots__/language.test.js.snap deleted file mode 100644 index 48cc8d4e..00000000 --- a/test/js/component/language/__snapshots__/language.test.js.snap +++ /dev/null @@ -1,73 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`language component should show selected language 1`] = ` - -
- - -
-
-`; - -exports[`language component should update the selected language 1`] = ` - -
- - -
-
-`; diff --git a/test/js/component/legend/__snapshots__/legend.test.js.snap b/test/js/component/legend/__snapshots__/legend.test.js.snap deleted file mode 100644 index 9f80d20f..00000000 --- a/test/js/component/legend/__snapshots__/legend.test.js.snap +++ /dev/null @@ -1,53 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`legend component should render legend 1`] = ` - - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 202 m - -
-
-`; diff --git a/test/js/component/map/__snapshots__/map.test.js.snap b/test/js/component/map/__snapshots__/map.test.js.snap deleted file mode 100644 index 7ca8c496..00000000 --- a/test/js/component/map/__snapshots__/map.test.js.snap +++ /dev/null @@ -1,92 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`map component should render map 1`] = ` - -
-
-
-
-
-
- -
-
-
- -`; diff --git a/test/js/component/map_query/__snapshots__/map_query.test.js.snap b/test/js/component/map_query/__snapshots__/map_query.test.js.snap deleted file mode 100644 index 4af9e2ae..00000000 --- a/test/js/component/map_query/__snapshots__/map_query.test.js.snap +++ /dev/null @@ -1,19 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`map query component should render map query 1`] = ` - -
- -`; - -exports[`map query component should render map query 2`] = ` - -
- -`; - -exports[`map query component should render map query 3`] = ` - -
- -`; diff --git a/test/js/component/menu/__snapshots__/menu.test.js.snap b/test/js/component/menu/__snapshots__/menu.test.js.snap deleted file mode 100644 index 7e437a0d..00000000 --- a/test/js/component/menu/__snapshots__/menu.test.js.snap +++ /dev/null @@ -1,509 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`menu component should render menu 1`] = ` - -
-
-
- -
-
- -
-
-
-
- - - -
-
-
-
- -`; - -exports[`search should show GNSS coordinates 1`] = ` - -
-
-
- -
-
- -
-
-
-
- - - -
-
-
-
- -`; - -exports[`search should show LV95 coordinates 1`] = ` - -
-
-
- -
-
- -
-
-
-
- - - -
-
-
-
-
- - menu.search.title.coordinates.lv95 - - - 1 - -
- -
-
-
-
-`; - -exports[`search should show results 1`] = ` - -
-
-
- -
-
- -
-
-
-
- - - -
-
-
-
-
- - Set 1 - - - 2 - -
- - -
-
-
- - Set 2 - - - 2 - -
- - -
-
-
-
-`; diff --git a/test/js/component/permalink/__snapshots__/permalink.test.js.snap b/test/js/component/permalink/__snapshots__/permalink.test.js.snap deleted file mode 100644 index 0522ba01..00000000 --- a/test/js/component/permalink/__snapshots__/permalink.test.js.snap +++ /dev/null @@ -1,29 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`permalink component should render permalink modal 1`] = ` - - - -`; - -exports[`permalink component should render permalink modal 2`] = ` - - - -`; diff --git a/test/js/component/real_estate/__snapshots__/real_estate.test.js.snap b/test/js/component/real_estate/__snapshots__/real_estate.test.js.snap deleted file mode 100644 index 4327446f..00000000 --- a/test/js/component/real_estate/__snapshots__/real_estate.test.js.snap +++ /dev/null @@ -1,45 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`real estate component should render real estate 1`] = ` - -
-
- Liegenschaft 70 extract.real_estate.at Oberwil (BL) -
-
-
- - extract.real_estate.egrid: - -
-
- CH1234 -
-
-
-
- - extract.real_estate.area: - -
-
- 35121 m² -
-
-
-
-`; diff --git a/test/js/component/real_estate_layer/__snapshots__/real_estate_layer.test.js.snap b/test/js/component/real_estate_layer/__snapshots__/real_estate_layer.test.js.snap deleted file mode 100644 index 4c7101ed..00000000 --- a/test/js/component/real_estate_layer/__snapshots__/real_estate_layer.test.js.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`real estate layer component should render real estate layer element 1`] = ``; diff --git a/test/js/component/responsible_office/__snapshots__/responsible_office.test.js.snap b/test/js/component/responsible_office/__snapshots__/responsible_office.test.js.snap deleted file mode 100644 index bb25925f..00000000 --- a/test/js/component/responsible_office/__snapshots__/responsible_office.test.js.snap +++ /dev/null @@ -1,24 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`responsible office component should render responsible office 1`] = ` - -
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-`; diff --git a/test/js/component/responsible_office/__snapshots__/responsible_office.test.jsx.snap b/test/js/component/responsible_office/__snapshots__/responsible_office.test.jsx.snap index c5df34f4..c01fc49b 100644 --- a/test/js/component/responsible_office/__snapshots__/responsible_office.test.jsx.snap +++ b/test/js/component/responsible_office/__snapshots__/responsible_office.test.jsx.snap @@ -22,3 +22,20 @@ exports[`responsible office component > should render responsible office 1`] = `
`; + +exports[`responsible office component > should render responsible office without url 1`] = ` + +
+
+ extract.topic.responsible_office +
+
+ Bundesamt für Verkehr BAV +
+
+
+`; diff --git a/test/js/component/responsible_office/responsible_office.test.jsx b/test/js/component/responsible_office/responsible_office.test.jsx index fea930b1..7227359e 100644 --- a/test/js/component/responsible_office/responsible_office.test.jsx +++ b/test/js/component/responsible_office/responsible_office.test.jsx @@ -11,8 +11,6 @@ import extract from "../../../../samples/extract.json"; describe('responsible office component', () => { - let component; - beforeEach(() => { act(() => { MainStore.dispatch(initLanguages({ @@ -20,18 +18,34 @@ describe('responsible office component', () => { available: ['de'] })); }); + }); + + it('should render responsible office', () => { const restrictions = groupRestrictionsByTopic( extract.GetExtractByIdResponse.extract.RealEstate.RestrictionOnLandownership, extract.GetExtractByIdResponse.extract.ConcernedTheme )['chStatischeWaldgrenzen']['inForce']; - component = render( + const component = render( ); + expect(component.asFragment()).toMatchSnapshot(); }); - it('should render responsible office', () => { + it('should render responsible office without url', () => { + const restrictions = groupRestrictionsByTopic( + extract.GetExtractByIdResponse.extract.RealEstate.RestrictionOnLandownership, + extract.GetExtractByIdResponse.extract.ConcernedTheme + )['chStatischeWaldgrenzen']['inForce']; + restrictions.forEach((restriction) => { + restriction['ResponsibleOffice']['OfficeAtWeb'] = null; + }); + const component = render( + + + + ); expect(component.asFragment()).toMatchSnapshot(); }); diff --git a/test/js/component/static_extract/__snapshots__/static_extract.test.js.snap b/test/js/component/static_extract/__snapshots__/static_extract.test.js.snap deleted file mode 100644 index d7d73185..00000000 --- a/test/js/component/static_extract/__snapshots__/static_extract.test.js.snap +++ /dev/null @@ -1,15 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`static extract component should render static extract button 1`] = ` - - - -`; diff --git a/test/js/component/topic/__snapshots__/topic.test.js.snap b/test/js/component/topic/__snapshots__/topic.test.js.snap deleted file mode 100644 index d704dafd..00000000 --- a/test/js/component/topic/__snapshots__/topic.test.js.snap +++ /dev/null @@ -1,620 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`topic component should render topic 1`] = ` - -
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 202 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - Baugesetz, 3891.100 - - -
-
- - Revision Ortsplanung, 07.447 - - -
-
- extract.topic.document.laws -
-
- - Raumplanungsverordnung für den Kanton Graubünden (KRVO), BR 801.110 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (RPG), SR 700 - - -
-
- - Raumplanungsgesetz für den Kanton Graubünden (KRG), BR 801.100 - - -
-
- extract.topic.document.hints -
-
- - Guter Ratschlag - - -
-
- - Seht guter Ratschlag mit langem titel: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis venenatis posuere. Nunc sollicitudin fermentum bibendum. Nulla ut massa enim. Sed rhoncus euismod venenatis - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-`; - -exports[`topic component should render topic 2`] = ` - -
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 202 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - Baugesetz, 3891.100 - - -
-
- - Revision Ortsplanung, 07.447 - - -
-
- extract.topic.document.laws -
-
- - Raumplanungsverordnung für den Kanton Graubünden (KRVO), BR 801.110 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (RPG), SR 700 - - -
-
- - Raumplanungsgesetz für den Kanton Graubünden (KRG), BR 801.100 - - -
-
- extract.topic.document.hints -
-
- - Guter Ratschlag - - -
-
- - Seht guter Ratschlag mit langem titel: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis venenatis posuere. Nunc sollicitudin fermentum bibendum. Nulla ut massa enim. Sed rhoncus euismod venenatis - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-`; diff --git a/test/js/component/topic_layers/__snapshots__/topic_layers.test.js.snap b/test/js/component/topic_layers/__snapshots__/topic_layers.test.js.snap deleted file mode 100644 index 1dd2975e..00000000 --- a/test/js/component/topic_layers/__snapshots__/topic_layers.test.js.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`topic layers component should render tiled topic layer element 1`] = ``; - -exports[`topic layers component should render tiled topic layer element 2`] = ``; - -exports[`topic layers component should render untiled topic layer element 1`] = ``; - -exports[`topic layers component should render untiled topic layer element 2`] = ``; diff --git a/test/js/component/topic_list/__snapshots__/topic_list.test.js.snap b/test/js/component/topic_list/__snapshots__/topic_list.test.js.snap deleted file mode 100644 index a1b51332..00000000 --- a/test/js/component/topic_list/__snapshots__/topic_list.test.js.snap +++ /dev/null @@ -1,2375 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`topic with restriction component should render topics 1`] = ` - -
-
-
-
- - Nutzungsplanung (kantonal/kommunal): Grundnutzung - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 101 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 63 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Nutzungsplanung (kantonal/kommunal): Überlagernde Elemente - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 3608 m - - 2 - - - - 10.3% -
- - - Belastet, untersuchungsbedürftig - - 2 - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 7824 m - - 2 - - - - 22.3% -
-
-
- extract.topic.document.legal_provisions -
-
- - Revision Ortsplanung, 07.447 - - -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (AltlV), SR 700 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Kataster der belasteten Standorte im Bereich der zivilen Flugplätze - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, keine schädlichen oder lästigen Einwirkungen zu erwarten - - 1 - -
-
-
- extract.topic.document.legal_provisions -
-
- - BL-Ditt-3-I-01 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Zivilluftfahrt BAZL - -
-
-
-
-
-
-
-
- - Kataster der belasteten Standorte im Bereich des öffentlichen Verkehrs - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 3608 m - - 2 - - - - 10.3% -
- - - Belastet, untersuchungsbedürftig - - 2 - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - - 7824 m - - 2 - - - - 22.3% -
- - - Belastet, untersuchungsbedürftig - - 101 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - Revision Ortsplanung, 07.447 - - -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (AltlV), SR 700 - - -
-
- extract.topic.document.hints -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 63 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Grundwasserschutzzonen - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Fassungsbereich (Zone S1) - - - 7824 m - - 2 - - - - 22.3% -
-
-
- extract.topic.document.legal_provisions -
-
- - B61001 - - -
-
- extract.topic.document.laws -
-
- - Umweltschutzgesetz (USG), SR 814.01 - - -
-
- - Altlasten-Verordnung (AltlV), SR 814.680 - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
- - Statische Waldgrenzen - -
-
-

- -

-
-
-
-
- - extract.topic.opacity: - -
-
- - 100% - -
-
- -
-
- - - - - - - - - - - - - - - -
- extract.topic.legend.type - - - extract.topic.legend.part - - extract.topic.legend.part_in_percent -
- - - Belastet, untersuchungsbedürftig - - 202 m - -
-
-
- extract.topic.document.legal_provisions -
-
- - Baugesetz, 3891.100 - - -
-
- - Revision Ortsplanung, 07.447 - - -
-
- extract.topic.document.laws -
-
- - Raumplanungsverordnung für den Kanton Graubünden (KRVO), BR 801.110 - - -
-
- - Bundesgesetz über die Raumplanung (Raumplanungsgesetz, RPG) (RPG), SR 700 - - -
-
- - Raumplanungsgesetz für den Kanton Graubünden (KRG), BR 801.100 - - -
-
- extract.topic.document.hints -
-
- - Guter Ratschlag - - -
-
- - Seht guter Ratschlag mit langem titel: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis venenatis posuere. Nunc sollicitudin fermentum bibendum. Nulla ut massa enim. Sed rhoncus euismod venenatis - - -
-
-
-
- extract.topic.responsible_office -
-
- - Bundesamt für Verkehr BAV - -
-
-
-
-
-
-
-
-
-`; - -exports[`topic without restriction component should render topics 1`] = ` - -
-
    -
  • - Projektierungszonen Nationalstrassen -
  • -
  • - Projektierungszonen Eisenbahnanlagen -
  • -
  • - Baulinien Eisenbahnanlagen -
  • -
  • - Projektierungszonen Flughafenanlagen -
  • -
  • - Baulinien Flughafenanlagen -
  • -
  • - Sicherheitszonenplan -
  • -
  • - Kataster der belasteten Standorte -
  • -
  • - Grundwasserschutzareale -
  • -
  • - Lärmempfindlichkeitsstufen (in Nutzungszonen) -
  • -
  • - Waldabstandslinien -
  • -
-
-
-`; diff --git a/test/js/component/user_guide/__snapshots__/user_guide.test.js.snap b/test/js/component/user_guide/__snapshots__/user_guide.test.js.snap deleted file mode 100644 index 78330ca9..00000000 --- a/test/js/component/user_guide/__snapshots__/user_guide.test.js.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`user guide component should not render button 1`] = ``; - -exports[`user guide component should render button 1`] = ` - - - -`; diff --git a/test/js/util/language.test.js b/test/js/util/language.test.js index 124dd5d6..03e1e3a3 100644 --- a/test/js/util/language.test.js +++ b/test/js/util/language.test.js @@ -12,7 +12,15 @@ describe('getLocalizedText', () => { } ]; - it('should return null', () => { + it('should return null for undefined input value', () => { + expect(getLocalizedText(undefined, 'en', 'en')).toBe(null); + }); + + it('should return null for null as input value', () => { + expect(getLocalizedText(null, 'en', 'en')).toBe(null); + }); + + it('should return null for empty list', () => { expect(getLocalizedText([], 'en', 'en')).toBe(null); }); @@ -41,7 +49,15 @@ describe('getLocalizedUrl', () => { } ]; - it('should return null', () => { + it('should return null for undefined input value', () => { + expect(getLocalizedUrl(undefined, 'en', 'en')).toBe(null); + }); + + it('should return null for null as input value', () => { + expect(getLocalizedUrl(null, 'en', 'en')).toBe(null); + }); + + it('should return null for emtpy list', () => { expect(getLocalizedUrl([], 'en', 'en')).toBe(null); });