|
| 1 | +import { mountThemedComponent } from '@shared/tests/utils'; |
| 2 | +import { SideNavigation } from '@ui5/webcomponents-react/lib/SideNavigation'; |
| 3 | +import { SideNavigationListItem } from '@ui5/webcomponents-react/lib/SideNavigationListItem'; |
| 4 | +import { SideNavigationOpenState } from '@ui5/webcomponents-react/lib/SideNavigationOpenState'; |
| 5 | +import React from 'react'; |
| 6 | + |
| 7 | +describe('SideNavigation', () => { |
| 8 | + test('Expanded', () => { |
| 9 | + const wrapper = mountThemedComponent( |
| 10 | + <SideNavigation |
| 11 | + openState={SideNavigationOpenState.Expandend} |
| 12 | + selectedId={'sales-leads'} |
| 13 | + footerItems={[ |
| 14 | + <SideNavigationListItem text="Legal Information" icon="sap-icon://compare" />, |
| 15 | + <SideNavigationListItem text="Useful Links" icon="sap-icon://chain-link" /> |
| 16 | + ]} |
| 17 | + > |
| 18 | + <SideNavigationListItem text="Overview" icon="sap-icon://home" id="home" /> |
| 19 | + <SideNavigationListItem text="Calendar" icon="sap-icon://calendar" id="calendar" /> |
| 20 | + <SideNavigationListItem text="Customers" icon="sap-icon://employee" id="customers" /> |
| 21 | + <SideNavigationListItem text="Sales" icon="sap-icon://lead" id="sales"> |
| 22 | + <SideNavigationListItem text="My Opportunities" icon="sap-icon://home" id="sales-opportunities" /> |
| 23 | + <SideNavigationListItem text="My Leads" icon="sap-icon://home" id="sales-leads" /> |
| 24 | + <SideNavigationListItem text="My CPQS" icon="sap-icon://home" id="sales-cpqs" /> |
| 25 | + </SideNavigationListItem> |
| 26 | + <SideNavigationListItem text="Deliveries" icon="sap-icon://add-product" id="delivieries" /> |
| 27 | + </SideNavigation> |
| 28 | + ); |
| 29 | + expect(wrapper.render()).toMatchSnapshot(); |
| 30 | + }); |
| 31 | + |
| 32 | + test('Expanded without Icons', () => { |
| 33 | + const wrapper = mountThemedComponent( |
| 34 | + <SideNavigation |
| 35 | + openState={SideNavigationOpenState.Expandend} |
| 36 | + selectedId={'sales-leads'} |
| 37 | + noIcons |
| 38 | + footerItems={[ |
| 39 | + <SideNavigationListItem text="Legal Information" icon="sap-icon://compare" />, |
| 40 | + <SideNavigationListItem text="Useful Links" icon="sap-icon://chain-link" /> |
| 41 | + ]} |
| 42 | + > |
| 43 | + <SideNavigationListItem text="Overview" icon="sap-icon://home" id="home" /> |
| 44 | + <SideNavigationListItem text="Calendar" icon="sap-icon://calendar" id="calendar" /> |
| 45 | + <SideNavigationListItem text="Customers" icon="sap-icon://employee" id="customers" /> |
| 46 | + <SideNavigationListItem text="Sales" icon="sap-icon://lead" id="sales"> |
| 47 | + <SideNavigationListItem text="My Opportunities" icon="sap-icon://home" id="sales-opportunities" /> |
| 48 | + <SideNavigationListItem text="My Leads" icon="sap-icon://home" id="sales-leads" /> |
| 49 | + <SideNavigationListItem text="My CPQS" icon="sap-icon://home" id="sales-cpqs" /> |
| 50 | + </SideNavigationListItem> |
| 51 | + <SideNavigationListItem text="Deliveries" icon="sap-icon://add-product" id="delivieries" /> |
| 52 | + </SideNavigation> |
| 53 | + ); |
| 54 | + expect(wrapper.render()).toMatchSnapshot(); |
| 55 | + }); |
| 56 | + |
| 57 | + test('Condensed', () => { |
| 58 | + const wrapper = mountThemedComponent( |
| 59 | + <SideNavigation |
| 60 | + openState={SideNavigationOpenState.Condensed} |
| 61 | + selectedId={'sales-leads'} |
| 62 | + footerItems={[ |
| 63 | + <SideNavigationListItem text="Legal Information" icon="sap-icon://compare" />, |
| 64 | + <SideNavigationListItem text="Useful Links" icon="sap-icon://chain-link" /> |
| 65 | + ]} |
| 66 | + > |
| 67 | + <SideNavigationListItem text="Overview" icon="sap-icon://home" id="home" /> |
| 68 | + <SideNavigationListItem text="Calendar" icon="sap-icon://calendar" id="calendar" /> |
| 69 | + <SideNavigationListItem text="Customers" icon="sap-icon://employee" id="customers" /> |
| 70 | + <SideNavigationListItem text="Sales" icon="sap-icon://lead" id="sales"> |
| 71 | + <SideNavigationListItem text="My Opportunities" icon="sap-icon://home" id="sales-opportunities" /> |
| 72 | + <SideNavigationListItem text="My Leads" icon="sap-icon://home" id="sales-leads" /> |
| 73 | + <SideNavigationListItem text="My CPQS" icon="sap-icon://home" id="sales-cpqs" /> |
| 74 | + </SideNavigationListItem> |
| 75 | + <SideNavigationListItem text="Deliveries" icon="sap-icon://add-product" id="delivieries" /> |
| 76 | + </SideNavigation> |
| 77 | + ); |
| 78 | + expect(wrapper.render()).toMatchSnapshot(); |
| 79 | + }); |
| 80 | + test('Collapsed', () => { |
| 81 | + const wrapper = mountThemedComponent( |
| 82 | + <SideNavigation |
| 83 | + openState={SideNavigationOpenState.Collapsed} |
| 84 | + selectedId={'sales-leads'} |
| 85 | + footerItems={[ |
| 86 | + <SideNavigationListItem text="Legal Information" icon="sap-icon://compare" />, |
| 87 | + <SideNavigationListItem text="Useful Links" icon="sap-icon://chain-link" /> |
| 88 | + ]} |
| 89 | + > |
| 90 | + <SideNavigationListItem text="Overview" icon="sap-icon://home" id="home" /> |
| 91 | + <SideNavigationListItem text="Calendar" icon="sap-icon://calendar" id="calendar" /> |
| 92 | + <SideNavigationListItem text="Customers" icon="sap-icon://employee" id="customers" /> |
| 93 | + <SideNavigationListItem text="Sales" icon="sap-icon://lead" id="sales"> |
| 94 | + <SideNavigationListItem text="My Opportunities" icon="sap-icon://home" id="sales-opportunities" /> |
| 95 | + <SideNavigationListItem text="My Leads" icon="sap-icon://home" id="sales-leads" /> |
| 96 | + <SideNavigationListItem text="My CPQS" icon="sap-icon://home" id="sales-cpqs" /> |
| 97 | + </SideNavigationListItem> |
| 98 | + <SideNavigationListItem text="Deliveries" icon="sap-icon://add-product" id="delivieries" /> |
| 99 | + </SideNavigation> |
| 100 | + ); |
| 101 | + expect(wrapper.render()).toMatchSnapshot(); |
| 102 | + }); |
| 103 | +}); |
0 commit comments