From 68bda9e1044df7e9e048b86d4ec52997647224a2 Mon Sep 17 00:00:00 2001 From: Gilad Lekner Date: Tue, 5 Mar 2019 14:21:36 +0200 Subject: [PATCH] fixes #26052 - navigation missing IDs --- .../react_app/components/Layout/LayoutSelectors.js | 3 ++- .../__tests__/__snapshots__/LayoutSelectors.test.js.snap | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/webpack/assets/javascripts/react_app/components/Layout/LayoutSelectors.js b/webpack/assets/javascripts/react_app/components/Layout/LayoutSelectors.js index 3ae882cdee7..d6602400be1 100644 --- a/webpack/assets/javascripts/react_app/components/Layout/LayoutSelectors.js +++ b/webpack/assets/javascripts/react_app/components/Layout/LayoutSelectors.js @@ -1,5 +1,5 @@ import { createSelector } from 'reselect'; -import { get } from 'lodash'; +import { get, snakeCase } from 'lodash'; import { noop } from '../../common/helpers'; export const selectLayout = state => state.layout; @@ -29,6 +29,7 @@ const patternflyItems = (data, currentLocation, currentOrganization) => { const childrenArray = []; item.children.forEach(child => { const childObject = { + id: `menu_item_${snakeCase(child.name)}`, title: child.name, isDivider: child.type === 'divider' && !!child.name, className: diff --git a/webpack/assets/javascripts/react_app/components/Layout/__tests__/__snapshots__/LayoutSelectors.test.js.snap b/webpack/assets/javascripts/react_app/components/Layout/__tests__/__snapshots__/LayoutSelectors.test.js.snap index 0e3588bdeb7..4723a5f21f1 100644 --- a/webpack/assets/javascripts/react_app/components/Layout/__tests__/__snapshots__/LayoutSelectors.test.js.snap +++ b/webpack/assets/javascripts/react_app/components/Layout/__tests__/__snapshots__/LayoutSelectors.test.js.snap @@ -93,6 +93,7 @@ Array [ Object { "className": "", "href": "/", + "id": "menu_item_dashboard", "isDivider": false, "onClick": [Function], "preventHref": true, @@ -101,6 +102,7 @@ Array [ Object { "className": "", "href": "/fact_values", + "id": "menu_item_facts", "isDivider": false, "onClick": [Function], "preventHref": true, @@ -116,6 +118,7 @@ Array [ Object { "className": "", "href": "/hosts/new", + "id": "menu_item_all_hosts", "isDivider": false, "onClick": [Function], "preventHref": true, @@ -124,6 +127,7 @@ Array [ Object { "className": "", "href": "/architectures", + "id": "menu_item_architectures", "isDivider": false, "onClick": [Function], "preventHref": true, @@ -139,6 +143,7 @@ Array [ Object { "className": "", "href": "/environments", + "id": "menu_item_environments", "isDivider": false, "onClick": [Function], "preventHref": true, @@ -147,6 +152,7 @@ Array [ Object { "className": "", "href": "/architectures", + "id": "menu_item_architectures", "isDivider": false, "onClick": [Function], "preventHref": true, @@ -162,6 +168,7 @@ Array [ Object { "className": "", "href": "/domains", + "id": "menu_item_domains", "isDivider": false, "onClick": [Function], "preventHref": true, @@ -170,6 +177,7 @@ Array [ Object { "className": "", "href": "/realms", + "id": "menu_item_realms", "isDivider": false, "onClick": [Function], "preventHref": true,