fix: solve small pm chat ui issues
unwrap the pill fix the fetching images in pm not auto download
This commit is contained in:
@@ -8,6 +8,7 @@ import { HttpClient } from '@angular/common/http';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Subject, of } from 'rxjs';
|
||||
import { ElectronBridgeService } from '../../../core/platform/electron/electron-bridge.service';
|
||||
import type { ActiveGameCandidateResult } from '../../../core/platform/electron/electron-api.models';
|
||||
import { RealtimeSessionFacade } from '../../../core/realtime';
|
||||
import { ServerDirectoryFacade } from '../../server-directory';
|
||||
import { UsersActions } from '../../../store/users/users.actions';
|
||||
@@ -117,12 +118,38 @@ describe('GameActivityService sync', () => {
|
||||
})
|
||||
}));
|
||||
});
|
||||
|
||||
it('does not ask Electron for running games while the app window is focused', () => {
|
||||
const getActiveGameCandidate = vi.fn<() => Promise<ActiveGameCandidateResult>>(async () => ({
|
||||
candidate: null,
|
||||
fallbackProcessNames: ['Hades.exe']
|
||||
}));
|
||||
const getRunningProcessNames = vi.fn(async () => ['Hades.exe']);
|
||||
const context = createServiceContext({
|
||||
currentUser: alice,
|
||||
allUsers: [alice],
|
||||
documentHasFocus: true,
|
||||
electronApi: {
|
||||
getActiveGameCandidate,
|
||||
getRunningProcessNames
|
||||
}
|
||||
});
|
||||
|
||||
context.service.start();
|
||||
|
||||
expect(getActiveGameCandidate).not.toHaveBeenCalled();
|
||||
expect(getRunningProcessNames).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
interface ServiceContextOptions {
|
||||
currentUser: User;
|
||||
allUsers: User[];
|
||||
electronApi?: { getRunningProcessNames: () => Promise<string[]> } | null;
|
||||
electronApi?: {
|
||||
getActiveGameCandidate?: () => Promise<ActiveGameCandidateResult>;
|
||||
getRunningProcessNames?: () => Promise<string[]>;
|
||||
} | null;
|
||||
documentHasFocus?: boolean;
|
||||
processNames?: string[];
|
||||
gameMatchResponse?: GameMatchResponse;
|
||||
}
|
||||
@@ -141,6 +168,8 @@ interface ServiceContext {
|
||||
}
|
||||
|
||||
function createServiceContext(options: ServiceContextOptions): ServiceContext {
|
||||
vi.stubGlobal('document', { hasFocus: () => options.documentHasFocus ?? false });
|
||||
|
||||
const currentUser = signal<User | null>(options.currentUser);
|
||||
const allUsers = signal<User[]>(options.allUsers);
|
||||
const incomingMessages = new Subject<ChatEvent>();
|
||||
|
||||
Reference in New Issue
Block a user