• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAP / ui5-webcomponents-react / 9695229913

27 Jun 2024 10:49AM CUT coverage: 33.288% (-48.1%) from 81.421%
9695229913

Pull #5984

github

web-flow
Merge ffa7cbff1 into ef490f487
Pull Request #5984: refactor(enrichEventWithDetails): pass through `detail`, improve types

665 of 3841 branches covered (17.31%)

10 of 11 new or added lines in 2 files covered. (90.91%)

2848 existing lines in 100 files now uncovered.

1968 of 5912 relevant lines covered (33.29%)

179.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/packages/main/src/internal/ModalsContext.ts
1
import type { ComponentType, ContextType, Dispatch, RefCallback, RefObject } from 'react';
2
import { createContext, useContext } from 'react';
3

4
export interface UpdateModalStateAction<Props, DomRef, ContainerElement = HTMLElement> {
5
  type: 'set' | 'reset';
6
  payload?: ModalState<Props, DomRef, ContainerElement> | { id: string };
7
}
8

9
export interface ModalState<Props, DomRef, ContainerElement> {
10
  Component: ComponentType;
11
  props: Props;
12
  ref: RefObject<DomRef> | RefCallback<DomRef>;
13
  container: ContainerElement;
14
  id: string;
15
}
16

17
interface IModalsContext<Props, DomRef> {
18
  setModal?: Dispatch<UpdateModalStateAction<Props, DomRef>>;
19
}
20

21
const ModalsContext = createContext<IModalsContext<Record<string, any>, HTMLElement>>({
141✔
22
  setModal: null
23
});
24

25
export function getModalContext() {
26
  if (!globalThis['@ui5/webcomponents-react']?.ModalsContext) {
578✔
27
    globalThis['@ui5/webcomponents-react'] ??= {};
126✔
28
    globalThis['@ui5/webcomponents-react'].ModalsContext = ModalsContext;
126✔
29
  }
30

31
  return globalThis['@ui5/webcomponents-react'].ModalsContext;
578✔
32
}
33

34
export const useModalsContext = (): ContextType<typeof ModalsContext> => {
141✔
UNCOV
35
  return useContext(getModalContext());
×
36
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc