@jobber/components-native 0.100.2 → 0.101.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export interface ContentOverlayProps {
7
7
  /**
8
8
  * Title of overlay, appears in the header next to the close button.
9
9
  */
10
- readonly title: string;
10
+ readonly title?: string;
11
11
  /**
12
12
  * Optional accessibilityLabel describing the overlay.
13
13
  * This will read out when the overlay is opened.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.100.2",
3
+ "version": "0.101.0",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -94,5 +94,5 @@
94
94
  "react-native-safe-area-context": "^5.4.0",
95
95
  "react-native-svg": ">=12.0.0"
96
96
  },
97
- "gitHead": "eb3ec903f5732493d7627ff5c0687dc3b8ca5375"
97
+ "gitHead": "60059897a6dcbc0277774885c6a7ade0658c335d"
98
98
  }
@@ -73,7 +73,7 @@ function renderContentOverlay(
73
73
  onCloseCallback,
74
74
  onOpenCallback,
75
75
  onBeforeExitCallback,
76
- } = getDefaultOptions(),
76
+ }: Partial<testRendererOptions> = getDefaultOptions(),
77
77
  ) {
78
78
  const contentOverlayRef = createRef<ContentOverlayRef>();
79
79
 
@@ -82,7 +82,7 @@ function renderContentOverlay(
82
82
  <View>
83
83
  <Text>I am a bunch of text</Text>
84
84
  <Button
85
- label={buttonLabel}
85
+ label={buttonLabel || "Open Content Overlay"}
86
86
  onPress={() => {
87
87
  contentOverlayRef?.current?.open?.();
88
88
  }}
@@ -125,7 +125,7 @@ async function renderAndOpenContentOverlay(
125
125
  });
126
126
 
127
127
  await waitFor(() => {
128
- expect(screen.getByTestId("ATL-Overlay-Header")).toBeDefined();
128
+ // expect(screen.getByTestId("ATL-Overlay-Header")).toBeDefined();
129
129
  expect(props.onOpenCallback).toHaveBeenCalledTimes(1);
130
130
  });
131
131
  }
@@ -443,3 +443,40 @@ describe("onBeforeExit callback", () => {
443
443
  });
444
444
  });
445
445
  });
446
+
447
+ describe("title prop", () => {
448
+ it("should render the title", async () => {
449
+ const options: testRendererOptions = {
450
+ ...getDefaultOptions(),
451
+ title: "Awesome Title",
452
+ };
453
+ await renderAndOpenContentOverlay(options);
454
+ expect(screen.getByText(options.title)).toBeDefined();
455
+ });
456
+ describe("when title is not passed but showDismiss is true", () => {
457
+ it("should should render dismiss button", async () => {
458
+ const options: testRendererOptions = {
459
+ ...getDefaultOptions(),
460
+ showDismiss: true,
461
+ };
462
+ await renderAndOpenContentOverlay(options);
463
+ expect(screen.getByTestId("ATL-Overlay-CloseButton")).toBeDefined();
464
+ });
465
+ });
466
+ describe("when title is not passed but showDismiss is false", () => {
467
+ it("should not render the header", async () => {
468
+ jest
469
+ .spyOn(AccessibilityInfo, "isScreenReaderEnabled")
470
+ .mockImplementation(() => Promise.resolve(false));
471
+ const options: testRendererOptions = {
472
+ ...getDefaultOptions(),
473
+ showDismiss: false,
474
+ title: "",
475
+ fullScreen: false,
476
+ };
477
+ await renderAndOpenContentOverlay(options);
478
+ console.log(options);
479
+ expect(screen.queryByTestId("ATL-Overlay-Header")).toBeNull();
480
+ });
481
+ });
482
+ });
@@ -205,7 +205,7 @@ export function ContentOverlay({
205
205
 
206
206
  const renderHeader = () => {
207
207
  const closeOverlayA11YLabel = t("ContentOverlay.close", {
208
- title: title,
208
+ title: title || "",
209
209
  });
210
210
 
211
211
  const headerStyles = [
@@ -223,7 +223,7 @@ export function ContentOverlay({
223
223
  },
224
224
  ];
225
225
 
226
- return (
226
+ return title || shouldShowDismiss ? (
227
227
  <View testID="ATL-Overlay-Header">
228
228
  <View style={headerStyles}>
229
229
  <View
@@ -266,7 +266,7 @@ export function ContentOverlay({
266
266
  <View style={headerShadowStyles} />
267
267
  </View>
268
268
  </View>
269
- );
269
+ ) : null;
270
270
  };
271
271
 
272
272
  return (
@@ -8,7 +8,7 @@ export interface ContentOverlayProps {
8
8
  /**
9
9
  * Title of overlay, appears in the header next to the close button.
10
10
  */
11
- readonly title: string;
11
+ readonly title?: string;
12
12
  /**
13
13
  * Optional accessibilityLabel describing the overlay.
14
14
  * This will read out when the overlay is opened.