Skip to content

Commit

Permalink
Added OUIA props to Sidenav (#996)
Browse files Browse the repository at this point in the history
* Added OUIA props to Sidenav

* Updated snapshots
  • Loading branch information
Dmitrii Misharov authored Oct 5, 2020
1 parent 5f39fb6 commit e35d634
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
4 changes: 3 additions & 1 deletion src/js/App/Sidenav/AppSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const AppSwitcher = ({ currentApp }) => {
component='a'
href={`${document.baseURI}${app.id}`}
className={classNames({ 'ins-c-app-switcher__current': app.title === activeApp })}
key={app.id}>
key={app.id}
ouiaId={app.id}>
{app.title}
</DropdownItem>
);
Expand All @@ -51,6 +52,7 @@ const AppSwitcher = ({ currentApp }) => {
}
isOpen={isOpen}
dropdownItems={dropdownItems(currentApp)}
ouiaId='App Switcher'
/>
</section>
);
Expand Down
7 changes: 4 additions & 3 deletions src/js/App/Sidenav/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ export const Navigation = ({
item.subItems ? <NavExpandable
className="ins-m-navigation-align"
title={item.title}
ouia-nav-group={item.id}
itemID={item.id}
ouiaId={item.id}
key={key}
isActive={item.active}
isExpanded={item.active}>
{
item.subItems.map((subItem, subKey) => <NavigationItem
ignoreCase={subItem.ignoreCase}
itemID={subItem.reload || subItem.id}
ouia-nav-item={subItem.reload || subItem.id}
ouiaId={subItem.reload || subItem.id}
key={subKey}
title={subItem.title}
parent={subItem.reload ? activeLocation : `${activeLocation}${item.id ? `/${item.id}` : ''}`}
Expand All @@ -118,7 +118,7 @@ export const Navigation = ({
</NavExpandable> : <NavigationItem
ignoreCase={item.ignoreCase}
itemID={item.id}
ouia-nav-item={item.id}
ouiaId={item.id}
key={key}
title={item.title}
parent={activeLocation}
Expand All @@ -131,6 +131,7 @@ export const Navigation = ({
className='ins-c-navigation__additional-links'
key={key}
to={item.url}
ouiaId={item.id}
target='_blank'
rel='noopener noreferrer'>
{item.title} {item.external && <ExternalLinkAltIcon/>}
Expand Down
2 changes: 1 addition & 1 deletion src/js/App/Sidenav/__snapshots__/AppSwitcher.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`AppSwitcher should render correctly 1`] = `
>
<div
className="pf-c-dropdown ins-c-app-switcher__dropdown"
data-ouia-component-id={0}
data-ouia-component-id="App Switcher"
data-ouia-component-type="PF4/Dropdown"
data-ouia-safe={true}
>
Expand Down
24 changes: 12 additions & 12 deletions src/js/App/Sidenav/__snapshots__/Navigation.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ exports[`Navigation should render corectly 1`] = `
isExpanded={true}
itemID="overview"
key="0"
ouia-nav-group="overview"
ouiaId="overview"
srText=""
title="Overview"
>
Expand All @@ -260,7 +260,7 @@ exports[`Navigation should render corectly 1`] = `
itemID="someID"
key="0"
onClick={[Function]}
ouia-nav-item="someID"
ouiaId="someID"
parent="openshift/overview"
title="Clusters"
/>
Expand All @@ -270,7 +270,7 @@ exports[`Navigation should render corectly 1`] = `
itemID="rules"
key="1"
onClick={[Function]}
ouia-nav-item="rules"
ouiaId="rules"
parent="openshift"
title="Rules"
/>
Expand All @@ -279,7 +279,7 @@ exports[`Navigation should render corectly 1`] = `
itemID="topics"
key="2"
onClick={[Function]}
ouia-nav-item="topics"
ouiaId="topics"
parent="openshift"
title="Topics"
/>
Expand All @@ -288,7 +288,7 @@ exports[`Navigation should render corectly 1`] = `
itemID="inventory"
key="3"
onClick={[Function]}
ouia-nav-item="inventory"
ouiaId="inventory"
parent="openshift"
title="Inventory"
/>
Expand All @@ -297,7 +297,7 @@ exports[`Navigation should render corectly 1`] = `
itemID="remediations"
key="4"
onClick={[Function]}
ouia-nav-item="remediations"
ouiaId="remediations"
parent="openshift"
title="Remediations"
/>
Expand Down Expand Up @@ -368,7 +368,7 @@ exports[`Navigation should render correctly 2 1`] = `
isExpanded={true}
itemID="overview"
key="0"
ouia-nav-group="overview"
ouiaId="overview"
srText=""
title="Overview"
>
Expand All @@ -377,7 +377,7 @@ exports[`Navigation should render correctly 2 1`] = `
itemID="someID"
key="0"
onClick={[Function]}
ouia-nav-item="someID"
ouiaId="someID"
parent="openshift/overview"
title="Clusters"
/>
Expand All @@ -387,7 +387,7 @@ exports[`Navigation should render correctly 2 1`] = `
itemID="rules"
key="1"
onClick={[Function]}
ouia-nav-item="rules"
ouiaId="rules"
parent="openshift"
title="Rules"
/>
Expand All @@ -396,7 +396,7 @@ exports[`Navigation should render correctly 2 1`] = `
itemID="topics"
key="2"
onClick={[Function]}
ouia-nav-item="topics"
ouiaId="topics"
parent="openshift"
title="Topics"
/>
Expand All @@ -405,7 +405,7 @@ exports[`Navigation should render correctly 2 1`] = `
itemID="inventory"
key="3"
onClick={[Function]}
ouia-nav-item="inventory"
ouiaId="inventory"
parent="openshift"
title="Inventory"
/>
Expand All @@ -414,7 +414,7 @@ exports[`Navigation should render correctly 2 1`] = `
itemID="remediations"
key="4"
onClick={[Function]}
ouia-nav-item="remediations"
ouiaId="remediations"
parent="openshift"
title="Remediations"
/>
Expand Down

0 comments on commit e35d634

Please sign in to comment.