@applicaster/zapp-react-native-utils 13.0.0-alpha.1692038547 → 13.0.0-alpha.1700735421

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.
Files changed (51) hide show
  1. package/README.md +0 -10
  2. package/analyticsUtils/AnalyticsEvents/sendHeaderClickEvent.ts +1 -1
  3. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -1
  4. package/analyticsUtils/currentScreenProperities.ts +6 -4
  5. package/analyticsUtils/index.tsx +3 -4
  6. package/analyticsUtils/manager.ts +1 -1
  7. package/appUtils/HooksManager/index.ts +1 -1
  8. package/appUtils/contextKeysManager/index.ts +2 -2
  9. package/appUtils/contextKeysManager/utils/index.ts +2 -1
  10. package/appUtils/focusManager/index.ts +1 -10
  11. package/appUtils/keyCodes/index.ts +11 -7
  12. package/appUtils/orientationHelper.ts +0 -1
  13. package/appUtils/platform/platformUtils.ts +6 -0
  14. package/appUtils/playerManager/index.ts +1 -1
  15. package/equalUtils/__tests__/isEqual/combination.test.ts +263 -0
  16. package/equalUtils/index.ts +49 -30
  17. package/focusManager/FocusManager.ts +14 -28
  18. package/focusManager/index.ts +41 -4
  19. package/functionUtils/index.ts +21 -8
  20. package/manifestUtils/fonts/index.js +5 -6
  21. package/manifestUtils/sharedConfiguration/screenPicker/__tests__/utils.test.js +304 -0
  22. package/manifestUtils/sharedConfiguration/screenPicker/stylesFields.js +875 -0
  23. package/manifestUtils/sharedConfiguration/screenPicker/utils.js +130 -0
  24. package/numberUtils/index.ts +7 -5
  25. package/package.json +4 -9
  26. package/reactHooks/app/useAppState.ts +2 -2
  27. package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +5 -7
  28. package/reactHooks/autoscrolling/useTrackedView.ts +12 -1
  29. package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +39 -88
  30. package/reactHooks/navigation/__mocks__/useNavigation.ts +3 -0
  31. package/reactHooks/navigation/__tests__/index.test.tsx +6 -17
  32. package/reactHooks/navigation/index.ts +12 -24
  33. package/reactHooks/navigation/useProfilerLogging.ts +15 -0
  34. package/reactUtils/__tests__/__snapshots__/reactUtilsHelpers.test.js.snap +16 -4
  35. package/reactUtils/__tests__/reactUtils.test.js +1 -19
  36. package/reactUtils/__tests__/reactUtilsHelpers.test.js +72 -71
  37. package/reactUtils/createContext/__tests__/__snapshots__/helpers.test.js.snap +6 -72
  38. package/reactUtils/createContext/__tests__/__snapshots__/provider.test.js.snap +3 -28
  39. package/reactUtils/createContext/__tests__/__snapshots__/withConsumer.test.js.snap +3 -4
  40. package/reactUtils/createContext/__tests__/__snapshots__/withProvider.test.js.snap +7 -3
  41. package/reactUtils/createContext/__tests__/helpers.test.js +107 -121
  42. package/reactUtils/createContext/__tests__/{index.test.js → index.test.ts} +2 -2
  43. package/reactUtils/createContext/__tests__/provider.test.js +4 -6
  44. package/reactUtils/createContext/__tests__/withConsumer.test.js +12 -12
  45. package/reactUtils/createContext/__tests__/withProvider.test.js +4 -4
  46. package/reactUtils/createContext/helpers.ts +6 -1
  47. package/reactUtils/createContext/index.ts +11 -25
  48. package/reactUtils/index.ts +0 -11
  49. package/testUtils/index.tsx +7 -18
  50. package/reactUtils/createContext/__tests__/index-no-react.test.js +0 -27
  51. /package/reactUtils/createContext/__tests__/__snapshots__/{index.test.js.snap → index.test.ts.snap} +0 -0
@@ -0,0 +1,130 @@
1
+ const defaultPlatforms = {
2
+ tvos: "tvOS",
3
+ android_tv: "Android TV",
4
+ lg_tv: "LG TV",
5
+ samsung_tv: "Samsung TV",
6
+ };
7
+
8
+ const global_defaults = {
9
+ fontSize: 20,
10
+ lineHeight: 40,
11
+ letterSpacing: 0.4,
12
+ };
13
+
14
+ const generateFontConfiguration = (platforms = defaultPlatforms) => {
15
+ const platformEntries = Object.entries(platforms);
16
+ const defaultsEntries = Object.entries(global_defaults);
17
+ const splitCamelCase = (str) => str.replace(/([a-z](?=[A-Z]))/g, "$1_");
18
+
19
+ return platformEntries.reduce((acc, [platformKey, platformValue]) => {
20
+ acc.push(
21
+ ...defaultsEntries.reduce((acc2, [valueKey, defaultValue]) => {
22
+ acc2.push({
23
+ type: "number_input",
24
+ label: `${platformValue} ${splitCamelCase(valueKey).replace(
25
+ "_",
26
+ " "
27
+ )}`,
28
+ key: `${platformKey}_${splitCamelCase(valueKey)}`.toLowerCase(),
29
+ initial_value: defaultValue,
30
+ });
31
+
32
+ return acc2;
33
+ }, [])
34
+ );
35
+
36
+ return acc;
37
+ }, []);
38
+ };
39
+
40
+ const conditional_rule = (key, condition_value) => ({
41
+ key,
42
+ condition_value,
43
+ });
44
+
45
+ const createConditionalConfig = (rules, matchAll = false) => ({
46
+ rules: matchAll ? "all_conditions" : "conditional",
47
+ conditional_fields: rules.map((field) => conditional_rule(...field)),
48
+ });
49
+
50
+ const conditional_horizontal_type = createConditionalConfig([
51
+ ["styles/screen_picker_type", "horizontal"],
52
+ ]);
53
+
54
+ const conditional_vertical_type = createConditionalConfig([
55
+ ["styles/screen_picker_type", "vertical"],
56
+ ]);
57
+
58
+ const conditional_horizontal_type_item_fixed = createConditionalConfig(
59
+ [
60
+ ["styles/screen_picker_type", "horizontal"],
61
+ ["styles/screen_picker_item_size", "fixed"],
62
+ ],
63
+ true
64
+ );
65
+
66
+ const conditional_horizontal_type_item_dynamic = createConditionalConfig(
67
+ [
68
+ ["styles/screen_picker_type", "horizontal"],
69
+ ["screen_picker_horizontal_display_type", "dynamic"],
70
+ ],
71
+ true
72
+ );
73
+
74
+ const conditional_horizontal_display_type_fixed = createConditionalConfig(
75
+ [
76
+ ["styles/screen_picker_type", "horizontal"],
77
+ ["styles/screen_picker_horizontal_display_type", "fixed"],
78
+ ],
79
+ true
80
+ );
81
+
82
+ const conditional_horizontal_asset_on = createConditionalConfig(
83
+ [
84
+ ["styles/screen_picker_type", "horizontal"],
85
+ ["styles/screen_picker_asset_switch", true],
86
+ ],
87
+ true
88
+ );
89
+
90
+ const createVariationFields = ({
91
+ prefix = "screen_picker",
92
+ key,
93
+ type = "number_input",
94
+ label = "",
95
+ variants: [a, b],
96
+ }) => {
97
+ return [
98
+ {
99
+ type,
100
+ key: `${prefix}${prefix.length > 0 ? "_" : ""}${
101
+ a?.key ?? "vertical"
102
+ }_${key}`,
103
+ label: a?.label ?? label,
104
+ initial_value: a.initial_value,
105
+ ...conditional_vertical_type,
106
+ },
107
+ {
108
+ type,
109
+ key: `${prefix}${prefix.length > 0 ? "_" : ""}${
110
+ b.key ?? "horizontal"
111
+ }_${key}`,
112
+ label: b?.label ?? label,
113
+ initial_value: b.initial_value,
114
+ ...conditional_horizontal_type,
115
+ },
116
+ ];
117
+ };
118
+
119
+ module.exports = {
120
+ generateFontConfiguration,
121
+ createVariationFields,
122
+ createConditionalConfig,
123
+ conditional_rule,
124
+ conditional_horizontal_type,
125
+ conditional_vertical_type,
126
+ conditional_horizontal_type_item_fixed,
127
+ conditional_horizontal_type_item_dynamic,
128
+ conditional_horizontal_display_type_fixed,
129
+ conditional_horizontal_asset_on,
130
+ };
@@ -3,7 +3,7 @@ import { logger } from "@applicaster/zapp-react-native-utils/logger";
3
3
 
4
4
  const numberUtilsLogger = logger?.addSubsystem("NumberUtils");
5
5
 
6
- export const toNumber = (value: any): number | undefined => {
6
+ export const toNumber = (value: unknown): number | undefined => {
7
7
  if (R.isNil(value) || R.isEmpty(value)) {
8
8
  return undefined;
9
9
  }
@@ -17,10 +17,12 @@ export const toNumber = (value: any): number | undefined => {
17
17
  return undefined;
18
18
  };
19
19
 
20
- export const toNumberWithDefault = (defaultValue: number, value: any): number =>
21
- toNumber(value) ?? defaultValue;
20
+ export const toNumberWithDefault = (
21
+ defaultValue: number,
22
+ value: unknown
23
+ ): number => toNumber(value) ?? defaultValue;
22
24
 
23
- export const toNumberWithDefaultZero = (value: any): number =>
25
+ export const toNumberWithDefaultZero = (value: unknown): number =>
24
26
  toNumberWithDefault(0, value);
25
27
 
26
28
  export const requireNumber = (obj, key: string) => {
@@ -39,7 +41,7 @@ export const requireNumber = (obj, key: string) => {
39
41
 
40
42
  export const toFiniteNumberWithDefault = (
41
43
  defaultValue: number,
42
- value: any
44
+ value: unknown
43
45
  ): number => {
44
46
  const possibleNumber = toNumberWithDefault(defaultValue, value);
45
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "13.0.0-alpha.1692038547",
3
+ "version": "13.0.0-alpha.1700735421",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,11 +28,9 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "13.0.0-alpha.1692038547",
31
+ "@applicaster/applicaster-types": "13.0.0-alpha.1700735421",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
- "create-react-context": "^0.2.3",
35
- "create-react-ref": "^0.1.0",
36
34
  "dayjs": "^1.11.10",
37
35
  "memoizee": "0.4.15",
38
36
  "prop-types": "^15.0.0",
@@ -42,13 +40,10 @@
42
40
  "@applicaster/zapp-pipes-v2-client": "*",
43
41
  "@react-native-community/netinfo": "*",
44
42
  "immer": "*",
45
- "react": "17.0.2",
46
- "react-native": "0.68.6",
43
+ "react": "*",
44
+ "react-native": "*",
47
45
  "uglify-js": "*",
48
46
  "validate-color": "*",
49
47
  "zustand": "*"
50
- },
51
- "devDependencies": {
52
- "@types/react-native": "0.69.6"
53
48
  }
54
49
  }
@@ -14,10 +14,10 @@ export function useAppState(returnIsActive) {
14
14
  };
15
15
 
16
16
  React.useEffect(() => {
17
- AppState.addEventListener("change", setAppState);
17
+ const unsubscribe = AppState.addEventListener("change", setAppState);
18
18
 
19
19
  return () => {
20
- AppState.removeEventListener("change", setAppState);
20
+ unsubscribe.remove();
21
21
  };
22
22
  }, []);
23
23
 
@@ -35,25 +35,23 @@ const Wrapper = ({ children }: { children: React.ReactChild }) => (
35
35
  const { useTrackedView } = require("../useTrackedView");
36
36
 
37
37
  describe("useTrackCurrentAutoScrollingElement", () => {
38
- it("should update position for selected component", async () => {
38
+ it("should update position for selected component - onViewportEnter", () => {
39
39
  const { result } = renderHook(() => useTrackedView("123"), {
40
40
  wrapper: Wrapper,
41
41
  });
42
42
 
43
- // Fast-forward until all timers have been executed
44
- jest.advanceTimersByTime(3000);
45
-
46
43
  expect(result.current.inViewPort).toBe(false);
47
44
 
48
45
  const mockRect = {
49
46
  rect: { left: 1, right: 1, top: 1, bottom: 1 },
50
47
  };
51
48
 
52
- act(() => {
53
- result.current.onPositionUpdated(mockRect);
49
+ act(async () => {
50
+ await result.current.onPositionUpdated(mockRect);
54
51
  });
55
52
 
56
- jest.advanceTimersByTime(3000);
53
+ // Fast-forward until all timers have been executed
54
+ jest.runAllTimers();
57
55
 
58
56
  expect(result.current.inViewPort).toBe(true);
59
57
 
@@ -2,6 +2,10 @@ import { useCallback, useEffect, useMemo, useState } from "react";
2
2
  import { useScreenTrackedViewPositionsContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenTrackedViewPositionsContext";
3
3
  import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
4
4
  import { findTrackedView } from "./utils/findTrackedView";
5
+ import { isNil } from "ramda";
6
+ import { withTimeout } from "@applicaster/zapp-react-native-utils/idleUtils";
7
+
8
+ const TIMEOUT_FOR_DELAY_ON_VIEWPORT_ENTER_EVENT = 500; // ms
5
9
 
6
10
  const getNormalizedRect = (rect, componentId, screenWidth, screenHeight) => {
7
11
  if (!rect) {
@@ -37,9 +41,16 @@ export const useTrackedView = (componentId: string) => {
37
41
  );
38
42
 
39
43
  const onPositionUpdated = useCallback(
40
- ({ rect }) => {
44
+ async ({ rect }) => {
41
45
  const currentPosition = normalizedRect(componentId, rect);
42
46
 
47
+ // There is an issue on the native side where they are unable to guarantee
48
+ // that the order of onViewportLeave and onViewportEnter events is always correct.
49
+ // This workaround/hack delays the onViewportEnter event to ensure it is received last.
50
+ if (!isNil(currentPosition)) {
51
+ await withTimeout(TIMEOUT_FOR_DELAY_ON_VIEWPORT_ENTER_EVENT);
52
+ }
53
+
43
54
  updateComponentsPositions(componentId, currentPosition as any);
44
55
 
45
56
  setInViewPort(!!currentPosition);
@@ -1,8 +1,7 @@
1
1
  import { renderHook } from "@testing-library/react-hooks";
2
- import * as reduxMockStore from "redux-mock-store";
3
- import thunk from "redux-thunk";
4
- import React from "react";
5
- import * as ReactRedux from "react-redux";
2
+ import { allFeedsIsReady, useBatchLoading } from "../useBatchLoading";
3
+ import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
4
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
6
5
 
7
6
  jest.mock("../../navigation");
8
7
 
@@ -13,17 +12,18 @@ jest.mock(
13
12
  })
14
13
  );
15
14
 
16
- const useBatchLoading = require("../useBatchLoading").useBatchLoading;
17
- const allFeedsIsReady = require("../useBatchLoading").allFeedsIsReady;
18
-
19
- const mockStore = reduxMockStore.default([thunk]);
20
-
21
- const wrapper: React.FC<any> = ({ children, store }) => (
22
- <ReactRedux.Provider store={store}>{children}</ReactRedux.Provider>
23
- );
15
+ const wrapper = WrappedWithProviders;
24
16
 
25
17
  describe("useBatchLoading", () => {
26
- const useDispatchSpy = jest.spyOn(ReactRedux, "useDispatch");
18
+ const data = [
19
+ { data: { source: "url1" }, component_type: "any" },
20
+ { data: { source: "url2" }, component_type: "any" },
21
+ { data: { source: "url3" }, component_type: "any" },
22
+ { data: { source: "url4" }, component_type: "any" },
23
+ { data: { source: "url5" }, component_type: "any" },
24
+ { data: { source: "url6" }, component_type: "any" },
25
+ // ... more items
26
+ ];
27
27
 
28
28
  beforeAll(() => {
29
29
  jest.useFakeTimers();
@@ -34,7 +34,7 @@ describe("useBatchLoading", () => {
34
34
  });
35
35
 
36
36
  it("loadPipesData start loading not started requests", () => {
37
- const store = mockStore({
37
+ const store = {
38
38
  zappPipes: {
39
39
  url1: {
40
40
  loading: true,
@@ -53,29 +53,17 @@ describe("useBatchLoading", () => {
53
53
  },
54
54
  },
55
55
  test: "true",
56
- });
57
-
58
- useDispatchSpy.mockReturnValue(store.dispatch);
56
+ };
59
57
 
60
58
  const initialBatchSize = 3;
61
59
  const riverId = "123";
62
60
 
63
- const data = [
64
- { data: { source: "url1" } },
65
- { data: { source: "url2" } },
66
- { data: { source: "url3" } },
67
- { data: { source: "url4" } },
68
- { data: { source: "url5" } },
69
- { data: { source: "url6" } },
70
- // ... more items
71
- ];
72
-
73
61
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
74
62
  wrapper,
75
63
  initialProps: { store },
76
64
  });
77
65
 
78
- const actions = store.getActions();
66
+ const actions = (appStore.getStore() as any).getActions();
79
67
 
80
68
  expect(actions).toHaveLength(2);
81
69
 
@@ -91,7 +79,7 @@ describe("useBatchLoading", () => {
91
79
  });
92
80
 
93
81
  it("loadPipesData start loading new feed when 1 feed is done loading and 1 is in loading state", () => {
94
- const store = mockStore({
82
+ const store = {
95
83
  zappPipes: {
96
84
  url1: {
97
85
  loading: false,
@@ -110,31 +98,17 @@ describe("useBatchLoading", () => {
110
98
  },
111
99
  },
112
100
  test: "true",
113
- });
114
-
115
- useDispatchSpy.mockReturnValue(store.dispatch);
101
+ };
116
102
 
117
103
  const initialBatchSize = 3;
118
104
  const riverId = "123";
119
105
 
120
- const data = [
121
- { data: { source: "url1" } },
122
- { data: { source: "url2" } },
123
- { data: { source: "url3" } },
124
- { data: { source: "url4" } },
125
- { data: { source: "url5" } },
126
- { data: { source: "url6" } },
127
- // ... more items
128
- ];
129
-
130
- expect(useDispatchSpy).toBeCalledTimes(0);
131
-
132
106
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
133
107
  wrapper,
134
108
  initialProps: { store },
135
109
  });
136
110
 
137
- const actions = store.getActions();
111
+ const actions = (appStore.getStore() as any).getActions();
138
112
 
139
113
  expect(actions).toHaveLength(1);
140
114
 
@@ -145,38 +119,26 @@ describe("useBatchLoading", () => {
145
119
  });
146
120
 
147
121
  it("loadPipesData has been called when no data cached", () => {
148
- const store = mockStore({
122
+ const store = {
149
123
  zappPipes: {},
150
124
  test: "true",
151
- });
152
-
153
- useDispatchSpy.mockReturnValue(store.dispatch);
125
+ };
154
126
 
155
127
  const initialBatchSize = 3;
156
128
  const riverId = "123";
157
129
 
158
- const data = [
159
- { data: { source: "url1" } },
160
- { data: { source: "url2" } },
161
- { data: { source: "url3" } },
162
- { data: { source: "url4" } },
163
- { data: { source: "url5" } },
164
- { data: { source: "url6" } },
165
- // ... more items
166
- ];
167
-
168
130
  renderHook(() => useBatchLoading(data, { initialBatchSize, riverId }), {
169
131
  wrapper,
170
132
  initialProps: { store },
171
133
  });
172
134
 
173
- const actions = store.getActions();
135
+ const actions = (appStore.getStore() as any).getActions();
174
136
 
175
137
  expect(actions).toHaveLength(3);
176
138
  });
177
139
 
178
140
  it("initial batch ready when all initial items loaded", () => {
179
- const store = mockStore({
141
+ const store = {
180
142
  zappPipes: {
181
143
  url1: {
182
144
  loading: false,
@@ -194,19 +156,11 @@ describe("useBatchLoading", () => {
194
156
  data: {},
195
157
  },
196
158
  },
197
- });
198
-
199
- useDispatchSpy.mockReturnValue(store.dispatch);
159
+ };
200
160
 
201
161
  const initialBatchSize = 3;
202
162
  const riverId = "123";
203
163
 
204
- const data: Partial<ZappUIComponent>[] = [
205
- { data: { source: "url1" } },
206
- { data: { source: "url2" } },
207
- { data: { source: "url3" } },
208
- ];
209
-
210
164
  const { result } = renderHook(
211
165
  () => useBatchLoading(data, { initialBatchSize, riverId }),
212
166
  { wrapper, initialProps: { store } }
@@ -216,12 +170,10 @@ describe("useBatchLoading", () => {
216
170
  });
217
171
 
218
172
  it("gallery-qb: loadPipesData should be called only once for first component in the gallery", () => {
219
- const store = mockStore({
173
+ const store = {
220
174
  zappPipes: {},
221
175
  test: "true",
222
- });
223
-
224
- useDispatchSpy.mockReturnValue(store.dispatch);
176
+ };
225
177
 
226
178
  const initialBatchSize = 3;
227
179
  const riverId = "123";
@@ -231,11 +183,11 @@ describe("useBatchLoading", () => {
231
183
  component_type: "gallery-qb",
232
184
  ui_components: [{ data: { source: "url1" } }],
233
185
  },
234
- { data: { source: "url2" } },
235
- { data: { source: "url3" } },
236
- { data: { source: "url4" } },
237
- { data: { source: "url5" } },
238
- { data: { source: "url6" } },
186
+ { data: { source: "url2" }, component_type: "any" },
187
+ { data: { source: "url3" }, component_type: "any" },
188
+ { data: { source: "url4" }, component_type: "any" },
189
+ { data: { source: "url5" }, component_type: "any" },
190
+ { data: { source: "url6" }, component_type: "any" },
239
191
  // ... more items
240
192
  ];
241
193
 
@@ -244,13 +196,13 @@ describe("useBatchLoading", () => {
244
196
  initialProps: { store },
245
197
  });
246
198
 
247
- const actions = store.getActions();
199
+ const actions = (appStore.getStore() as any).getActions();
248
200
 
249
201
  expect(actions).toHaveLength(1);
250
202
  });
251
203
 
252
204
  it("gallery-qb: initial batch ready when all initial items loaded", () => {
253
- const store = mockStore({
205
+ const store = {
254
206
  zappPipes: {
255
207
  url1: {
256
208
  loading: false,
@@ -258,20 +210,19 @@ describe("useBatchLoading", () => {
258
210
  data: {},
259
211
  },
260
212
  },
261
- });
262
-
263
- useDispatchSpy.mockReturnValue(store.dispatch);
213
+ };
264
214
 
265
215
  const initialBatchSize = 3;
266
216
  const riverId = "123";
267
217
 
268
- const data: Partial<ZappUIComponent>[] = [
218
+ const data = [
269
219
  {
270
220
  component_type: "gallery-qb",
271
- ui_components: [{ data: { source: "url1" } }],
221
+ data: {},
222
+ ui_components: [{ data: { source: "url1" } }] as any,
272
223
  },
273
- { data: { source: "url2" } },
274
- { data: { source: "url3" } },
224
+ { data: { source: "url2" }, component_type: "any" },
225
+ { data: { source: "url3" }, component_type: "any" },
275
226
  ];
276
227
 
277
228
  const { result } = renderHook(
@@ -3,5 +3,8 @@ export const useNavigation = jest.fn(() => ({
3
3
  screenData: {
4
4
  name: "someName",
5
5
  },
6
+ videoModalState: {
7
+ visible: false,
8
+ },
6
9
  currentRoute: "someRoute",
7
10
  }));
@@ -310,14 +310,14 @@ describe("navigation", () => {
310
310
  expect(navBarVisible).toBe(false);
311
311
  });
312
312
 
313
- it("returns false if it's secondary nav bar and hide_secondary_level_menu is true", () => {
313
+ it("returns false if it's secondary nav bar and show_secondary_level_menu is false", () => {
314
314
  const navBarVisible = isNavBarVisible(
315
315
  "",
316
316
  {
317
317
  navigations: [
318
318
  {
319
319
  styles: {
320
- hide_secondary_level_menu: true,
320
+ show_secondary_level_menu: false,
321
321
  },
322
322
  },
323
323
  ],
@@ -329,14 +329,14 @@ describe("navigation", () => {
329
329
  expect(navBarVisible).toBe(false);
330
330
  });
331
331
 
332
- it("returns true if it's secondary nav bar and hide_secondary_level_menu is false", () => {
332
+ it("returns true if it's secondary nav bar and show_secondary_level_menu is true", () => {
333
333
  const navBarVisible = isNavBarVisible(
334
334
  "",
335
335
  {
336
336
  navigations: [
337
337
  {
338
338
  styles: {
339
- hide_secondary_level_menu: false,
339
+ show_secondary_level_menu: true,
340
340
  },
341
341
  },
342
342
  ],
@@ -348,14 +348,14 @@ describe("navigation", () => {
348
348
  expect(navBarVisible).toBe(true);
349
349
  });
350
350
 
351
- it("returns true if it's first level menu and hide_secondary_level_menu is true", () => {
351
+ it("returns true if it's first level menu and show_secondary_level_menu is false", () => {
352
352
  const navBarVisible = isNavBarVisible(
353
353
  "",
354
354
  {
355
355
  navigations: [
356
356
  {
357
357
  styles: {
358
- hide_secondary_level_menu: true,
358
+ show_secondary_level_menu: false,
359
359
  },
360
360
  },
361
361
  ],
@@ -366,16 +366,5 @@ describe("navigation", () => {
366
366
 
367
367
  expect(navBarVisible).toBe(true);
368
368
  });
369
-
370
- it("returns true otherwise", () => {
371
- const navBarVisible = isNavBarVisible(
372
- "",
373
- { navigations: [] } as any,
374
- true,
375
- true
376
- );
377
-
378
- expect(navBarVisible).toBe(true);
379
- });
380
369
  });
381
370
  });