Skip to content

Commit

Permalink
Adjusting filter test and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
arivepr committed Sep 7, 2023
1 parent 5bfb546 commit 53cf84f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ describe('Drawer panel functionality', () => {
fireEvent.click(filterMenuItems[2]);

const filteredNotification = renderedResult.getAllByRole('listitem');

expect(filteredNotification.length === 1);
});
});
3 changes: 2 additions & 1 deletion src/components/NotificationsDrawer/DrawerPanelContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ const DrawerPanelBase = ({ innerRef }: DrawerPanelProps) => {
onClick={() => setIsFilterDropdownOpen(!isFilterDropdownOpen)}
id="notifications-filter-toggle"
variant="plain"
aria-label="Notifications filter"
>
<FilterIcon />
</MenuToggle>
Expand All @@ -199,7 +200,6 @@ const DrawerPanelBase = ({ innerRef }: DrawerPanelProps) => {
position: PopoverPosition.right,
}}
id="notifications-filter-dropdown"
aria-label="Notifications filter"
>
{filterDropdownItems()}
</Dropdown>
Expand All @@ -210,6 +210,7 @@ const DrawerPanelBase = ({ innerRef }: DrawerPanelProps) => {
onClick={() => setIsDropdownOpen(!isDropdownOpen)}
variant="plain"
id="notifications-actions-toggle"
aria-label="Notifications actions dropdown"
isFullWidth
>
<EllipsisVIcon />
Expand Down
2 changes: 1 addition & 1 deletion src/components/NotificationsDrawer/NotificationItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const NotificationItem: React.FC<NotificationItemProps> = ({ notification, onNav
return (
<React.Fragment>
<NotificationDrawerList>
<NotificationDrawerListItem variant="info" isRead={notification.read}>
<NotificationDrawerListItem aria-label={`Notification item ${notification.id}`} variant="info" isRead={notification.read}>
<NotificationDrawerListItemHeader title={notification.title} srTitle="Info notification:">
<Checkbox isChecked={notification.read} onChange={onCheckboxToggle} id="read-checkbox" name="read-checkbox" />
<Dropdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ export const readTestData = [
read: true,
source: 'MARS',
created: '25 mins ago',
}
},
];
3 changes: 2 additions & 1 deletion src/redux/chromeReducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ChromeModule, NavItem, Navigation } from '../@types/types';
import { ITLess, generateRoutesList, highlightItems, isBeta, levelArray } from '../utils/common';
import { ThreeScaleError } from '../utils/responseInterceptors';
import { AccessRequest, ChromeState, NotificationData } from './store';
import { testData } from '../components/NotificationsDrawer/notificationDrawerUtils';

export function contextSwitcherBannerReducer(state: ChromeState): ChromeState {
return {
Expand Down Expand Up @@ -338,7 +339,7 @@ export function toggleNotificationsReducer(state: ChromeState) {
...state,
notifications: {
...state.notifications,
data: state.notifications?.data || [],
data: testData, //state.notifications?.data || [],
isExpanded: !state.notifications?.isExpanded,
},
};
Expand Down

0 comments on commit 53cf84f

Please sign in to comment.