Skip to content

Commit 1ef3e9f

Browse files
[CCI] Remove unused tags in the navigation plugin (#3964)
* Remove unused tags in the navigation plugin (#3962) Signed-off-by: Andrey Myssak <andreymyssak@gmail.com> * Update CHANGELOG.md (#3962) Signed-off-by: Andrey Myssak <andreymyssak@gmail.com> --------- Signed-off-by: Andrey Myssak <andreymyssak@gmail.com> Signed-off-by: Manasvini B Suryanarayana <manasvis@amazon.com> Co-authored-by: Manasvini B Suryanarayana <manasvis@amazon.com>
1 parent 70b3420 commit 1ef3e9f

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
163163
- [Monaco editor] Add json worker support ([#3424](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3424))
164164
- [Multiple DataSource] Allow create and distinguish index pattern with same name but from different datasources ([#3604](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3604))
165165
- [Multiple DataSource] Integrate multiple datasource with dev tool console ([#3754](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3754))
166+
- [Navigation] Remove unused tags ([#3964](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3964))
166167
- [Notifications] Add id to toast api for deduplication ([#3752](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3752))
167168
- [UI] Add support for comma delimiters in the global filter bar ([#3686](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3686))
168169
- [UI] Indicate that IE is no longer supported ([#3641](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3641))

src/plugins/navigation/public/top_nav_menu/top_nav_menu.test.tsx

-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const dataShim = {
4343
};
4444

4545
describe('TopNavMenu', () => {
46-
const WRAPPER_SELECTOR = '.osdTopNavMenu__wrapper';
4746
const TOP_NAV_ITEM_SELECTOR = 'TopNavMenuItem';
4847
const SEARCH_BAR_SELECTOR = 'SearchBar';
4948
const menuItems: TopNavMenuData[] = [
@@ -66,28 +65,24 @@ describe('TopNavMenu', () => {
6665

6766
it('Should render nothing when no config is provided', () => {
6867
const component = shallowWithIntl(<TopNavMenu appName={'test'} />);
69-
expect(component.find(WRAPPER_SELECTOR).length).toBe(0);
7068
expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(0);
7169
expect(component.find(SEARCH_BAR_SELECTOR).length).toBe(0);
7270
});
7371

7472
it('Should not render menu items when config is empty', () => {
7573
const component = shallowWithIntl(<TopNavMenu appName={'test'} config={[]} />);
76-
expect(component.find(WRAPPER_SELECTOR).length).toBe(0);
7774
expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(0);
7875
expect(component.find(SEARCH_BAR_SELECTOR).length).toBe(0);
7976
});
8077

8178
it('Should render 1 menu item', () => {
8279
const component = shallowWithIntl(<TopNavMenu appName={'test'} config={[menuItems[0]]} />);
83-
expect(component.find(WRAPPER_SELECTOR).length).toBe(1);
8480
expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(1);
8581
expect(component.find(SEARCH_BAR_SELECTOR).length).toBe(0);
8682
});
8783

8884
it('Should render multiple menu items', () => {
8985
const component = shallowWithIntl(<TopNavMenu appName={'test'} config={menuItems} />);
90-
expect(component.find(WRAPPER_SELECTOR).length).toBe(1);
9186
expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(menuItems.length);
9287
expect(component.find(SEARCH_BAR_SELECTOR).length).toBe(0);
9388
});
@@ -96,7 +91,6 @@ describe('TopNavMenu', () => {
9691
const component = shallowWithIntl(
9792
<TopNavMenu appName={'test'} showSearchBar={true} data={dataShim as any} />
9893
);
99-
expect(component.find(WRAPPER_SELECTOR).length).toBe(1);
10094
expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(0);
10195
expect(component.find(SEARCH_BAR_SELECTOR).length).toBe(1);
10296
});
@@ -105,7 +99,6 @@ describe('TopNavMenu', () => {
10599
const component = shallowWithIntl(
106100
<TopNavMenu appName={'test'} config={menuItems} showSearchBar={true} data={dataShim as any} />
107101
);
108-
expect(component.find(WRAPPER_SELECTOR).length).toBe(1);
109102
expect(component.find(TOP_NAV_ITEM_SELECTOR).length).toBe(menuItems.length);
110103
expect(component.find(SEARCH_BAR_SELECTOR).length).toBe(1);
111104
});
@@ -170,7 +163,6 @@ describe('TopNavMenu', () => {
170163

171164
await refresh();
172165

173-
expect(component.find(WRAPPER_SELECTOR).length).toBe(1);
174166
expect(component.find(SEARCH_BAR_SELECTOR).length).toBe(1);
175167

176168
// menu is rendered outside of the component

src/plugins/navigation/public/top_nav_menu/top_nav_menu.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,21 @@ export function TopNavMenu(props: TopNavMenuProps): ReactElement | null {
115115
function renderLayout() {
116116
const { setMenuMountPoint } = props;
117117
const menuClassName = classNames('osdTopNavMenu', props.className);
118-
const wrapperClassName = 'osdTopNavMenu__wrapper';
119118
if (setMenuMountPoint) {
120119
return (
121120
<>
122121
<MountPointPortal setMountPoint={setMenuMountPoint}>
123-
<span className={wrapperClassName}>{renderMenu(menuClassName)}</span>
122+
{renderMenu(menuClassName)}
124123
</MountPointPortal>
125-
<span className={wrapperClassName}>{renderSearchBar()}</span>
124+
{renderSearchBar()}
126125
</>
127126
);
128127
} else {
129128
return (
130-
<span className={wrapperClassName}>
129+
<>
131130
{renderMenu(menuClassName)}
132131
{renderSearchBar()}
133-
</span>
132+
</>
134133
);
135134
}
136135
}

0 commit comments

Comments
 (0)