From d32b45d8355d7d423080d7ccb19e5cd7d7885969 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Fri, 10 Jul 2020 13:42:53 +0200 Subject: [PATCH] mgr/dashboard: StatefulTabDirective unit test fails Fixes: https://tracker.ceph.com/issues/46450 Signed-off-by: Volker Theile --- .../app/shared/directives/stateful-tab.directive.spec.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts index 70ecb1adb88c..bbac89aa4466 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts @@ -11,19 +11,18 @@ describe('StatefulTabDirective', () => { it('should get and select active tab', () => { const nav = new NgbNav('tablist', new NgbNavConfig(), null, null); spyOn(nav, 'select'); - spyOn(window.localStorage, 'getItem').and.returnValue('foo'); const directive = new StatefulTabDirective(nav); + directive.cdStatefulTab = 'bar'; + window.localStorage.setItem('tabset_bar', 'foo'); directive.ngOnInit(); - expect(window.localStorage.getItem).toHaveBeenCalled(); expect(nav.select).toHaveBeenCalledWith('foo'); }); it('should store active tab', () => { - spyOn(window.localStorage, 'setItem'); const directive = new StatefulTabDirective(null); directive.cdStatefulTab = 'bar'; const event: NgbNavChangeEvent = { activeId: '', nextId: 'xyz', preventDefault: null }; directive.onNavChange(event); - expect(window.localStorage.setItem).toHaveBeenCalledWith('tabset_bar', 'xyz'); + expect(window.localStorage.getItem('tabset_bar')).toBe('xyz'); }); }); -- 2.47.3