@@ -78,6 +78,15 @@ describe('<Shellbar />', () => {
7878 }
7979 ] ;
8080
81+ const actionsNoMenu = [
82+ {
83+ glyph : 'settings' ,
84+ label : 'Settings' ,
85+ notificationCount : 5 ,
86+ callback : ( ) => alert ( 'Settings selected!' )
87+ }
88+ ] ;
89+
8190 const notifications = {
8291 notificationCount : 2 ,
8392 label : 'Notifications' ,
@@ -100,14 +109,49 @@ describe('<Shellbar />', () => {
100109 callback : ( ) => alert ( 'Notification selected!' )
101110 } ;
102111
112+ const notificationsNoCount = {
113+ notificationCount : 0 ,
114+ label : 'Notifications' ,
115+ notificationsBody : (
116+ < Menu >
117+ < MenuList >
118+ < MenuItem url = '/' > Notification 1</ MenuItem >
119+ < MenuItem url = '/' > Notification 2</ MenuItem >
120+ < MenuItem url = '/' > Notification 3</ MenuItem >
121+ </ MenuList >
122+ </ Menu >
123+ ) ,
124+ noNotificationsBody : (
125+ < Menu >
126+ < MenuList >
127+ < MenuItem > There are no notifications</ MenuItem >
128+ </ MenuList >
129+ </ Menu >
130+ ) ,
131+ callback : ( ) => alert ( 'Notification selected!' )
132+ } ;
133+
134+ const notificationsNoBody = {
135+ notificationCount : 2 ,
136+ label : 'Notifications' ,
137+ callback : ( ) => alert ( 'Notification selected!' )
138+ } ;
139+
103140 const profile = {
104141 initials : 'JS' ,
105142 userName : 'John Snow' ,
106143 colorAccent : 8
107144 } ;
108145
146+ const profileWithImage = {
147+ initials : 'JS' ,
148+ userName : 'John Snow' ,
149+ colorAccent : 8 ,
150+ image : '//unpkg.com/fiori-fundamentals/dist/images/sap-logo.png'
151+ } ;
152+
109153 const productMenu = [
110- { name : 'Application A' , callback : ( ) => alert ( 'Application A selected!' ) } ,
154+ { name : 'Application A' , callback : ( ) => alert ( 'Application A selected!' ) , glyph : 'log' } ,
111155 { name : 'Application B' , callback : ( ) => alert ( 'Application B selected!' ) } ,
112156 { name : 'Application C' , callback : ( ) => alert ( 'Application C selected!' ) } ,
113157 { name : 'Application D' , callback : ( ) => alert ( 'Application D selected!' ) }
@@ -146,6 +190,54 @@ describe('<Shellbar />', () => {
146190 subtitle = 'Subtitle' />
147191 ) ;
148192
193+ const coPilotShellNoNotificationCount = (
194+ < Shellbar
195+ actions = { actions }
196+ copilot
197+ logoSAP
198+ notifications = { notificationsNoCount }
199+ productMenu = { productMenu }
200+ productSwitcher = { productSwitcher }
201+ productSwitcherList = { productSwitcherList }
202+ productTitle = 'Corporate Portal'
203+ profile = { profile }
204+ profileMenu = { profileMenu }
205+ searchInput = { searchInput }
206+ subtitle = 'Subtitle' />
207+ ) ;
208+
209+ const coPilotShellNoNotificationBody = (
210+ < Shellbar
211+ actions = { actions }
212+ copilot
213+ logoSAP
214+ notifications = { notificationsNoBody }
215+ productMenu = { productMenu }
216+ productSwitcher = { productSwitcher }
217+ productSwitcherList = { productSwitcherList }
218+ productTitle = 'Corporate Portal'
219+ profile = { profileWithImage }
220+ profileMenu = { profileMenu }
221+ searchInput = { searchInput }
222+ subtitle = 'Subtitle' />
223+ ) ;
224+
225+ const coPilotShellNoActionMenu = (
226+ < Shellbar
227+ actions = { actionsNoMenu }
228+ copilot
229+ logoSAP
230+ notifications = { notificationsNoCount }
231+ productMenu = { productMenu }
232+ productSwitcher = { productSwitcher }
233+ productSwitcherList = { productSwitcherList }
234+ productTitle = 'Corporate Portal'
235+ profile = { profile }
236+ profileMenu = { profileMenu }
237+ searchInput = { searchInput }
238+ subtitle = 'Subtitle' />
239+ ) ;
240+
149241 test ( 'create shellbar' , ( ) => {
150242 let component = renderer . create ( simpleShellBar ) ;
151243 let tree = component . toJSON ( ) ;
@@ -158,6 +250,26 @@ describe('<Shellbar />', () => {
158250 component = renderer . create ( coPilotShell ) ;
159251 tree = component . toJSON ( ) ;
160252 expect ( tree ) . toMatchSnapshot ( ) ;
253+
254+ component = renderer . create ( coPilotShellNoNotificationCount ) ;
255+ tree = component . toJSON ( ) ;
256+ expect ( tree ) . toMatchSnapshot ( ) ;
257+
258+ component = renderer . create ( coPilotShellNoActionMenu ) ;
259+ tree = component . toJSON ( ) ;
260+ expect ( tree ) . toMatchSnapshot ( ) ;
261+
262+ component = renderer . create ( coPilotShellNoNotificationBody ) ;
263+ tree = component . toJSON ( ) ;
264+ expect ( tree ) . toMatchSnapshot ( ) ;
265+ } ) ;
266+
267+ test ( 'click back button from collapsed product switcher' , ( ) => {
268+ const wrapper = mount ( coPilotShell ) ;
269+ wrapper . find ( 'a.fd-menu__item span.sap-icon--grid' ) . simulate ( 'click' ) ;
270+ wrapper . find ( 'span.fd-menu.sap-icon--nav-back' ) . simulate ( 'click' ) ;
271+
272+ expect ( wrapper . state ( [ 'showCollapsedProductSwitcherMenu' ] ) ) . toBeFalsy ( ) ;
161273 } ) ;
162274
163275 describe ( 'Prop spreading' , ( ) => {
0 commit comments