Skip to content

Commit

Permalink
iframeHandle optional
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer committed Jan 9, 2025
1 parent 1f96b6a commit cd6ee53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion container/src/LuigiContainer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
};
thisComponent.closeAlert = (id: string, dismissKey?: string) => {
ContainerAPI.closeAlert(id, iframeHandle, dismissKey);
ContainerAPI.closeAlert(id, dismissKey, iframeHandle);
};
containerService.registerContainer(thisComponent);
Expand Down
4 changes: 2 additions & 2 deletions container/src/api/container-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export class ContainerAPIFunctions {
* Send a message to the microfrontend notifying the alert has been closed
* @param id the id of the alert being closed
* @param dismissKey the dismiss key being sent if any (optional)
* @param iframeHandle the handle of the iframe to send the message to
* @param iframeHandle the handle of the iframe to send the message to (optional)
*/
closeAlert(id: string, iframeHandle: IframeHandle, dismissKey?: string) {
closeAlert(id: string, dismissKey?: string, iframeHandle?: IframeHandle) {
const message = dismissKey ? { id, dismissKey } : { id };
containerService.sendCustomMessageToIframe(iframeHandle, message, LuigiInternalMessageID.ALERT_CLOSED);
}
Expand Down
4 changes: 2 additions & 2 deletions container/test/api/container-api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ describe('Container Service', () => {
containerService.sendCustomMessageToIframe = jest.fn();
const spy = jest.spyOn(containerService, 'sendCustomMessageToIframe');

containerAPI.closeAlert(id, iframeHandle, dismissKey);
containerAPI.closeAlert(id, dismissKey, iframeHandle);

expect(spy).toHaveBeenCalledWith(iframeHandle, { id, dismissKey }, LuigiInternalMessageID.ALERT_CLOSED);
});
Expand All @@ -228,7 +228,7 @@ describe('Container Service', () => {
containerService.sendCustomMessageToIframe = jest.fn();
const spy = jest.spyOn(containerService, 'sendCustomMessageToIframe');

containerAPI.closeAlert(id, iframeHandle);
containerAPI.closeAlert(id, undefined, iframeHandle);

expect(spy).toHaveBeenCalledWith(iframeHandle, { id }, LuigiInternalMessageID.ALERT_CLOSED);
});
Expand Down

0 comments on commit cd6ee53

Please sign in to comment.