diff --git a/frontend/package.json b/frontend/package.json index 972762333..0db317a0d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -62,8 +62,8 @@ "postcss": "8.3.6", "qs": "6.7.0", "react": "^18.2.0", - "react-accessible-accordion": "3.3.5", - "react-burger-menu": "3.0.6", + "react-accessible-accordion": "^5.0.0", + "react-burger-menu": "^3.0.9", "react-country-flag": "^3.0.2", "react-dom": "^18.2.0", "react-easyfullscreen": "^1.1.1", diff --git a/frontend/src/components/Header/BurgerMenu/BurgerMenu.tsx b/frontend/src/components/Header/BurgerMenu/BurgerMenu.tsx index ce67a79c0..d4159075d 100644 --- a/frontend/src/components/Header/BurgerMenu/BurgerMenu.tsx +++ b/frontend/src/components/Header/BurgerMenu/BurgerMenu.tsx @@ -30,9 +30,10 @@ export const BurgerMenu: React.FC = ({ config, menuItems, displayState = burgerButtonClassName={burgerButtonClassName} burgerBarClassName="bg-white" menuClassName="bg-white p-4" - // We use mt-2 because we can't easily override the default element style with tailwind (default is top: 8 and we would like top: 16) crossButtonClassName="left-4 mt-2" crossClassName="bg-greyDarkColored" + overlayClassName="top-0" + className="top-0" > = ({ config, menuItems, displayState = {config.shouldDisplayFavorite && ( )} - + {config.supportedLanguages.length > 1 && ( + + )} { - const component = render( - , - ); - expect(component).toMatchSnapshot(); +describe('AAU, I can see a BurgerMenu', () => { + const props = { + config: { + primaryItemsNumber: 3, + shouldDisplayFavorite: true, + supportedLanguages: ['fr', 'en'], + defaultLanguage: 'fr', + }, + menuItems: [ + { + title: 'NationalPark', + url: 'https://www.ecrins-parcnational.fr/', + order: 1, + id: 2, + }, + { + title: 'Maisons du Parc', + url: 'https://www.ecrins-parcnational.fr/', + order: 2, + id: 1, + }, + { + title: 'Informations utiles', + url: 'https://www.ecrins-parcnational.fr/', + order: 3, + id: 3, + }, + ], + }; + it('with several languages', () => { + const component = render(); + expect(component).toMatchSnapshot(); + }); + + it('with only one language', () => { + const component = render( + , + ); + expect(component).toMatchSnapshot(); + }); }); diff --git a/frontend/src/components/Header/BurgerMenu/__tests__/__snapshots__/BurgerMenu.test.tsx.snap b/frontend/src/components/Header/BurgerMenu/__tests__/__snapshots__/BurgerMenu.test.tsx.snap index 135946a10..42cac2083 100644 --- a/frontend/src/components/Header/BurgerMenu/__tests__/__snapshots__/BurgerMenu.test.tsx.snap +++ b/frontend/src/components/Header/BurgerMenu/__tests__/__snapshots__/BurgerMenu.test.tsx.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AAU, I can see a BurgerMenu 1`] = ` +exports[`AAU, I can see a BurgerMenu with only one language 1`] = ` Object { "asFragment": [Function], "baseElement":
@@ -18,6 +18,7 @@ Object { @@ -39,7 +40,7 @@ Object {
+
+ , + "container":
+
+
+
+
+ + + + +
+
+ +
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[`AAU, I can see a BurgerMenu with several languages 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+
+
+
+ + + + +
+
+