Fix issue with changing servers and tabs (#2126)

This commit is contained in:
Devin Binnie
2022-05-26 14:17:44 -04:00
committed by GitHub
parent 581e1fd2e0
commit 37fe523e8c
4 changed files with 21 additions and 9 deletions

View File

@@ -199,6 +199,7 @@ describe('main/views/viewManager', () => {
destroy: destroyFn,
name: tab.name,
urlTypeTuple: tab.urlTypeTuple,
updateServerInfo: jest.fn(),
tab,
}));
});
@@ -288,11 +289,15 @@ describe('main/views/viewManager', () => {
const view = {
name: 'server1-tab1',
tab: {
server: {
name: 'server-1',
},
name: 'server1-tab1',
url: new URL('http://server1.com'),
},
urlTypeTuple: tuple('http://server1.com/', 'tab1'),
destroy: jest.fn(),
updateServerInfo: jest.fn(),
};
viewManager.currentView = 'server1-tab1';
viewManager.views.set('server1-tab1', view);
@@ -310,7 +315,6 @@ describe('main/views/viewManager', () => {
},
]);
expect(viewManager.showByName).toHaveBeenCalledWith('server1-tab1');
expect(viewManager.mainWindow.webContents.send).not.toHaveBeenCalled();
});
it('should show initial if currentView has been removed', () => {
@@ -322,6 +326,7 @@ describe('main/views/viewManager', () => {
},
urlTypeTuple: ['http://server.com/', 'tab1'],
destroy: jest.fn(),
updateServerInfo: jest.fn(),
};
viewManager.currentView = 'server1-tab1';
viewManager.views.set('server1-tab1', view);
@@ -338,7 +343,6 @@ describe('main/views/viewManager', () => {
],
},
]);
expect(viewManager.currentView).toBeUndefined();
expect(viewManager.showInitial).toBeCalled();
});