fix(ui): restore context panel session chats
This commit is contained in:
@@ -5,11 +5,13 @@ import {
|
||||
buildEmbeddedSessionChatURL,
|
||||
EMBEDDED_RUNTIME_BOOTSTRAP_REQUEST,
|
||||
EMBEDDED_RUNTIME_BOOTSTRAP_RESPONSE,
|
||||
EMBEDDED_VISIBILITY_REQUEST,
|
||||
getOrCreateEmbeddedSessionChatURL,
|
||||
getActiveEmbeddedSessionChatTab,
|
||||
getEmbeddedSessionChatOriginSessionId,
|
||||
isEmbeddedSessionChat,
|
||||
requestEmbeddedSessionRuntimeBootstrap,
|
||||
requestEmbeddedSessionVisibility,
|
||||
resetEmbeddedSessionChatCache,
|
||||
type EmbeddedSessionChatURLCacheEntry,
|
||||
} from './contextPanelEmbeddedChat';
|
||||
@@ -171,6 +173,22 @@ describe('active embedded session chat', () => {
|
||||
expect(getActiveEmbeddedSessionChatTab(tabs, null)).toBeNull();
|
||||
expect(getActiveEmbeddedSessionChatTab(tabs, 'missing-chat')).toBeNull();
|
||||
});
|
||||
|
||||
test('requests authoritative visibility from the same-origin parent', () => {
|
||||
installWindowLocation('http://127.0.0.1:5173/app?ocPanel=session-chat&sessionId=ses_1');
|
||||
resetEmbeddedSessionChatCache();
|
||||
const calls: Array<{ message: unknown; origin: string }> = [];
|
||||
(window as unknown as { parent: { postMessage: (message: unknown, origin: string) => void } }).parent = {
|
||||
postMessage: (message, origin) => calls.push({ message, origin }),
|
||||
};
|
||||
|
||||
requestEmbeddedSessionVisibility();
|
||||
|
||||
expect(calls).toEqual([{
|
||||
message: { type: EMBEDDED_VISIBILITY_REQUEST },
|
||||
origin: 'http://127.0.0.1:5173',
|
||||
}]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isEmbeddedSessionChat', () => {
|
||||
|
||||
Reference in New Issue
Block a user