Public Access
feat(dashboard): pick the banner game or turn the banner off
This commit is contained in:
1 parent
23e502bf5b
commit
83494519f9
11 files changed
+137
-23
No files matched your search
@@ -56,4 +56,28 @@ describe('GameDetail', () => {
|
||||
fireEvent.click(remove);
|
||||
expect(await screen.findByRole('button', {name: 'GAME_DETAIL.SET_BACKGROUND'})).toBeTruthy();
|
||||
});
|
||||
|
||||
it('uses the game as banner and goes back to the automatic banner', async () => {
|
||||
renderDetail();
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', {name: 'GAME_DETAIL.SET_BANNER'}));
|
||||
|
||||
const auto = await screen.findByRole('button', {name: 'SETTINGS.BANNER_AUTO'});
|
||||
const [, init] = fetch.mock.calls.find(([, call]) => call?.method === 'PUT');
|
||||
expect(JSON.parse(init.body)).toMatchObject({bannerAppid: 220, showBanner: true});
|
||||
|
||||
fireEvent.click(auto);
|
||||
expect(await screen.findByRole('button', {name: 'GAME_DETAIL.SET_BANNER'})).toBeTruthy();
|
||||
});
|
||||
|
||||
it('offers "use as banner" for the picked game while the banner is off, and turns it on', async () => {
|
||||
localStorage.setItem('tbp_appearance', JSON.stringify({bannerAppid: 220, showBanner: false}));
|
||||
renderDetail();
|
||||
|
||||
fireEvent.click(await screen.findByRole('button', {name: 'GAME_DETAIL.SET_BANNER'}));
|
||||
|
||||
await waitFor(() => expect(fetch.mock.calls.some(([, call]) => call?.method === 'PUT')).toBe(true));
|
||||
const [, init] = fetch.mock.calls.find(([, call]) => call?.method === 'PUT');
|
||||
expect(JSON.parse(init.body)).toMatchObject({bannerAppid: 220, showBanner: true});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user