@applicaster/zapp-react-native-ui-components 13.0.0-alpha.6525006318 → 13.0.0-alpha.7120331332
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.
- package/Components/AppContainer/__tests__/__snapshots__/AppContainer.test.js.snap +1 -1
- package/Components/AudioPlayer/__tests__/__snapshots__/Runtime.test.js.snap +4 -4
- package/Components/AudioPlayer/__tests__/__snapshots__/artWork.test.js.snap +3 -3
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +6 -6
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +7 -7
- package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +3 -3
- package/Components/AudioPlayer/__tests__/__snapshots__/summary.test.js.snap +2 -2
- package/Components/AudioPlayer/__tests__/__snapshots__/title.test.js.snap +2 -2
- package/Components/Cell/Cell.tsx +10 -9
- package/Components/Cell/CellWithFocusable.tsx +1 -1
- package/Components/Cell/TvOSCellComponent.tsx +3 -4
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +20 -20
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +5 -3
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +5 -5
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +11 -9
- package/Components/DisplayState/__tests__/__snapshots__/displayState.test.js.snap +2 -2
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +76 -7
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +53 -9
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +1 -0
- package/Components/Layout/TV/__tests__/__snapshots__/LayoutContainer.test.tsx.snap +1 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -3
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +9 -9
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -1
- package/Components/Layout/TV/__tests__/index.test.tsx +7 -3
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +3 -3
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/__snapshots__/index.test.tsx.snap +1 -1
- package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +180 -180
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +7 -7
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +34 -34
- package/Components/NativeFocusables/{index.js → index.ts} +4 -2
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +7 -7
- package/Components/OfflineHandler/__tests__/index.test.tsx +28 -25
- package/Components/PlayerContainer/PlayerContainer.tsx +2 -4
- package/Components/River/RefreshControl.tsx +1 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +17 -17
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +12 -12
- package/Components/River/__tests__/componentsMap.test.js +47 -12
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -1
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +1 -1
- package/Components/Screen/__tests__/Screen.test.tsx +41 -27
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -4
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +2 -2
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +31 -27
- package/Components/Tabs/Tab.tsx +1 -0
- package/Components/TextInputTv/__tests__/TextInputTv.test.js +42 -42
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +7 -0
- package/Components/TextInputTv/index.tsx +2 -2
- package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +2 -2
- package/Components/Transitioner/__tests__/__snapshots__/AnimationManager.test.js.snap +26 -26
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -9
- package/Components/Transitioner/__tests__/__snapshots__/config.test.js.snap +20 -20
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +12 -7
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +6 -6
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -10
- package/Components/VideoModal/ModalAnimation/index.ts +2 -1
- package/Components/VideoModal/ModalAnimation/useModalAnimationContext.ts +6 -0
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +12 -9
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +4 -4
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +78 -78
- package/Components/VideoModal/utils.ts +2 -4
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +2 -2
- package/Components/Viewport/ViewportTracker/__tests__/__snapshots__/viewportTracker.test.js.snap +1 -1
- package/Components/ZappFrameworkComponents/BarView/BarView.tsx +1 -0
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +11 -11
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +30 -30
- package/Contexts/ConfigutaionContext/__tests__/__snapshots__/ConfigurationProvider.test.tsx.snap +1 -1
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +18 -11
- package/Decorators/Analytics/{index.js → index.tsx} +11 -11
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +2 -2
- package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +77 -77
- package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +34 -39
- package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -9
- package/Decorators/RiverFeedLoader/index.tsx +1 -1
- package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +39 -0
- package/Decorators/RiverFeedLoader/utils/index.ts +29 -0
- package/Decorators/RiverFeedLoader/utils/usePipesContexts.ts +40 -0
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +5 -5
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +16 -10
- package/Decorators/ZappPipesDataConnector/index.tsx +1 -1
- package/package.json +5 -5
- package/Decorators/RiverFeedLoader/utils.ts +0 -100
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`<Runtime /> LTR renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
|
-
|
|
6
|
+
{
|
|
7
7
|
"height": 40,
|
|
8
8
|
"justifyContent": "flex-start",
|
|
9
9
|
"width": 600,
|
|
@@ -12,7 +12,7 @@ exports[`<Runtime /> LTR renders correctly 1`] = `
|
|
|
12
12
|
>
|
|
13
13
|
<Text
|
|
14
14
|
style={
|
|
15
|
-
|
|
15
|
+
{
|
|
16
16
|
"alignItems": "flex-end",
|
|
17
17
|
"color": "white",
|
|
18
18
|
"flexDirection": "row",
|
|
@@ -32,7 +32,7 @@ exports[`<Runtime /> LTR renders correctly 1`] = `
|
|
|
32
32
|
exports[`<Runtime /> RTL renders correctly 1`] = `
|
|
33
33
|
<View
|
|
34
34
|
style={
|
|
35
|
-
|
|
35
|
+
{
|
|
36
36
|
"height": 40,
|
|
37
37
|
"justifyContent": "flex-end",
|
|
38
38
|
"width": 600,
|
|
@@ -41,7 +41,7 @@ exports[`<Runtime /> RTL renders correctly 1`] = `
|
|
|
41
41
|
>
|
|
42
42
|
<Text
|
|
43
43
|
style={
|
|
44
|
-
|
|
44
|
+
{
|
|
45
45
|
"alignItems": "flex-start",
|
|
46
46
|
"color": "white",
|
|
47
47
|
"flexDirection": "row-reverse",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`<Artwork /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
|
-
|
|
6
|
+
{
|
|
7
7
|
"marginHorizontal": 24,
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -12,12 +12,12 @@ exports[`<Artwork /> renders correctly 1`] = `
|
|
|
12
12
|
fadeDuration={0}
|
|
13
13
|
resizeMode="cover"
|
|
14
14
|
source={
|
|
15
|
-
|
|
15
|
+
{
|
|
16
16
|
"uri": "https://example.com",
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
style={
|
|
20
|
-
|
|
20
|
+
{
|
|
21
21
|
"height": 400,
|
|
22
22
|
"width": 400,
|
|
23
23
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
4
4
|
<AudioPlayerLayout
|
|
5
5
|
config={
|
|
6
|
-
|
|
6
|
+
{
|
|
7
7
|
"artworkAspectRatio": "1:1",
|
|
8
8
|
"audioPlayerBackgroundImageQuery": "",
|
|
9
9
|
"backgroundColor": "black",
|
|
@@ -21,11 +21,11 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
21
21
|
"titleFontSize": undefined,
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
style={
|
|
24
|
+
style={{}}
|
|
25
25
|
>
|
|
26
26
|
<Channel
|
|
27
27
|
config={
|
|
28
|
-
|
|
28
|
+
{
|
|
29
29
|
"artworkAspectRatio": "1:1",
|
|
30
30
|
"audioPlayerBackgroundImageQuery": "",
|
|
31
31
|
"backgroundColor": "black",
|
|
@@ -47,7 +47,7 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
47
47
|
/>
|
|
48
48
|
<Title
|
|
49
49
|
config={
|
|
50
|
-
|
|
50
|
+
{
|
|
51
51
|
"artworkAspectRatio": "1:1",
|
|
52
52
|
"audioPlayerBackgroundImageQuery": "",
|
|
53
53
|
"backgroundColor": "black",
|
|
@@ -69,7 +69,7 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
69
69
|
/>
|
|
70
70
|
<Summary
|
|
71
71
|
config={
|
|
72
|
-
|
|
72
|
+
{
|
|
73
73
|
"artworkAspectRatio": "1:1",
|
|
74
74
|
"audioPlayerBackgroundImageQuery": "",
|
|
75
75
|
"backgroundColor": "black",
|
|
@@ -98,7 +98,7 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
98
98
|
audio_player_summary_color="white"
|
|
99
99
|
audio_player_title_color="white"
|
|
100
100
|
config={
|
|
101
|
-
|
|
101
|
+
{
|
|
102
102
|
"artworkAspectRatio": "1:1",
|
|
103
103
|
"audioPlayerBackgroundImageQuery": "",
|
|
104
104
|
"backgroundColor": "black",
|
|
@@ -4,7 +4,7 @@ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
|
|
|
4
4
|
<View
|
|
5
5
|
pointerEvents="none"
|
|
6
6
|
style={
|
|
7
|
-
|
|
7
|
+
{
|
|
8
8
|
"backgroundColor": "transparent",
|
|
9
9
|
"overflow": "hidden",
|
|
10
10
|
}
|
|
@@ -12,12 +12,12 @@ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
|
|
|
12
12
|
>
|
|
13
13
|
<ForwardRef(AnimatedComponentWrapper)
|
|
14
14
|
style={
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
17
|
"backgroundColor": "transparent",
|
|
18
18
|
"overflow": "hidden",
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
{
|
|
21
21
|
"opacity": 0,
|
|
22
22
|
},
|
|
23
23
|
]
|
|
@@ -26,19 +26,19 @@ exports[`<AudioPlayerLayout /> renders correctly 1`] = `
|
|
|
26
26
|
<ImageBackground
|
|
27
27
|
resizeMode="cover"
|
|
28
28
|
source={
|
|
29
|
-
|
|
29
|
+
{
|
|
30
30
|
"uri": "https://example.com",
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
style={
|
|
34
|
-
|
|
34
|
+
{
|
|
35
35
|
"flex": 1,
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
>
|
|
39
39
|
<View
|
|
40
40
|
style={
|
|
41
|
-
|
|
41
|
+
{
|
|
42
42
|
"backgroundColor": "transparent",
|
|
43
43
|
"overflow": "hidden",
|
|
44
44
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`<Channel /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
|
-
|
|
6
|
+
{
|
|
7
7
|
"height": 72,
|
|
8
8
|
"marginBottom": 30,
|
|
9
9
|
"width": 128,
|
|
@@ -13,12 +13,12 @@ exports[`<Channel /> renders correctly 1`] = `
|
|
|
13
13
|
<Image
|
|
14
14
|
fadeDuration={0}
|
|
15
15
|
source={
|
|
16
|
-
|
|
16
|
+
{
|
|
17
17
|
"uri": "https://example.com",
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
style={
|
|
21
|
-
|
|
21
|
+
{
|
|
22
22
|
"height": 72,
|
|
23
23
|
"width": 128,
|
|
24
24
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`<Summary /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
|
-
|
|
6
|
+
{
|
|
7
7
|
"height": 80,
|
|
8
8
|
"marginBottom": 30,
|
|
9
9
|
"width": 600,
|
|
@@ -13,7 +13,7 @@ exports[`<Summary /> renders correctly 1`] = `
|
|
|
13
13
|
<Text
|
|
14
14
|
numberOfLines={2}
|
|
15
15
|
style={
|
|
16
|
-
|
|
16
|
+
{
|
|
17
17
|
"color": "white",
|
|
18
18
|
"fontFamily": null,
|
|
19
19
|
"fontSize": 20,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`<Title /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
|
-
|
|
6
|
+
{
|
|
7
7
|
"height": 100,
|
|
8
8
|
"marginBottom": 12,
|
|
9
9
|
"width": 600,
|
|
@@ -13,7 +13,7 @@ exports[`<Title /> renders correctly 1`] = `
|
|
|
13
13
|
<Text
|
|
14
14
|
numberOfLines={2}
|
|
15
15
|
style={
|
|
16
|
-
|
|
16
|
+
{
|
|
17
17
|
"color": "white",
|
|
18
18
|
"fontFamily": null,
|
|
19
19
|
"fontSize": 38,
|
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -14,10 +14,7 @@ import { BaseFocusable } from "../BaseFocusable";
|
|
|
14
14
|
import { AccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager";
|
|
15
15
|
|
|
16
16
|
type Props = {
|
|
17
|
-
item:
|
|
18
|
-
id: string;
|
|
19
|
-
title: string;
|
|
20
|
-
};
|
|
17
|
+
item: ZappEntry;
|
|
21
18
|
index: number;
|
|
22
19
|
shouldScrollHorizontally: (arg1: [any]) => boolean | null | undefined;
|
|
23
20
|
shouldScrollVertically: (...args: any) => boolean | null | undefined;
|
|
@@ -33,10 +30,9 @@ type Props = {
|
|
|
33
30
|
id: string;
|
|
34
31
|
};
|
|
35
32
|
selected?: boolean;
|
|
36
|
-
CellRenderer: React.
|
|
37
|
-
item:
|
|
38
|
-
|
|
39
|
-
}> & { hasFocusableInside: (item: Record<string, string>) => boolean };
|
|
33
|
+
CellRenderer: React.FunctionComponent<any> & {
|
|
34
|
+
hasFocusableInside: (item: ZappEntry) => boolean;
|
|
35
|
+
};
|
|
40
36
|
preferredFocus: boolean;
|
|
41
37
|
navigator: {
|
|
42
38
|
push: (arg1: Record<any, any>) => void;
|
|
@@ -276,7 +272,12 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
276
272
|
|
|
277
273
|
if (isFocused) {
|
|
278
274
|
const accessibilityManager = AccessibilityManager.getInstance();
|
|
279
|
-
|
|
275
|
+
|
|
276
|
+
accessibilityManager.readText({
|
|
277
|
+
text: String(
|
|
278
|
+
item.extensions?.accessibility?.label || item.title
|
|
279
|
+
),
|
|
280
|
+
});
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
return (
|
|
@@ -36,10 +36,9 @@ type Props = {
|
|
|
36
36
|
component_type: string;
|
|
37
37
|
};
|
|
38
38
|
selected: boolean;
|
|
39
|
-
CellRenderer: React.
|
|
40
|
-
item: any;
|
|
41
|
-
|
|
42
|
-
}> & { hasFocusableInside: (item: any) => boolean };
|
|
39
|
+
CellRenderer: React.FunctionComponent<any> & {
|
|
40
|
+
hasFocusableInside: (item: any) => boolean;
|
|
41
|
+
};
|
|
43
42
|
preferredFocus: boolean;
|
|
44
43
|
navigator: {
|
|
45
44
|
push: (arg1: Record<any, any>) => void;
|
package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap
CHANGED
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
exports[`CellRendererResolver renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
someProp={
|
|
6
|
-
|
|
7
|
-
"cellOptions":
|
|
8
|
-
"cellStyles":
|
|
9
|
-
"ABCDE-123456":
|
|
10
|
-
"configuration":
|
|
6
|
+
{
|
|
7
|
+
"cellOptions": {},
|
|
8
|
+
"cellStyles": {
|
|
9
|
+
"ABCDE-123456": {
|
|
10
|
+
"configuration": {},
|
|
11
11
|
"plugin_identifier": "custom_renderer_plugin",
|
|
12
12
|
},
|
|
13
|
-
"FGHIJ-123456":
|
|
14
|
-
"configuration":
|
|
13
|
+
"FGHIJ-123456": {
|
|
14
|
+
"configuration": {},
|
|
15
15
|
"plugin_identifier": "unknown_plugin",
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
"component":
|
|
19
|
-
"styles":
|
|
18
|
+
"component": {
|
|
19
|
+
"styles": {
|
|
20
20
|
"cell_plugin_configuration_id": "ABCDE-123456",
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
|
-
"styles":
|
|
23
|
+
"styles": {},
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
/>
|
|
@@ -29,24 +29,24 @@ exports[`CellRendererResolver renders correctly 1`] = `
|
|
|
29
29
|
exports[`CellRendererResolver with a default renderer plugin renders correctly 1`] = `
|
|
30
30
|
<View
|
|
31
31
|
someProp={
|
|
32
|
-
|
|
33
|
-
"cellOptions":
|
|
34
|
-
"cellStyles":
|
|
35
|
-
"ABCDE-123456":
|
|
36
|
-
"configuration":
|
|
32
|
+
{
|
|
33
|
+
"cellOptions": {},
|
|
34
|
+
"cellStyles": {
|
|
35
|
+
"ABCDE-123456": {
|
|
36
|
+
"configuration": {},
|
|
37
37
|
"plugin_identifier": "custom_renderer_plugin",
|
|
38
38
|
},
|
|
39
|
-
"FGHIJ-123456":
|
|
40
|
-
"configuration":
|
|
39
|
+
"FGHIJ-123456": {
|
|
40
|
+
"configuration": {},
|
|
41
41
|
"plugin_identifier": "unknown_plugin",
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
|
-
"component":
|
|
45
|
-
"styles":
|
|
44
|
+
"component": {
|
|
45
|
+
"styles": {
|
|
46
46
|
"cell_plugin_configuration_id": "ABCDE-123456",
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
|
-
"styles":
|
|
49
|
+
"styles": {},
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
/>
|
|
@@ -2,9 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { shallow } from "enzyme";
|
|
4
4
|
|
|
5
|
-
jest.mock("../../default-cell-renderer", () =>
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
jest.mock("../../default-cell-renderer", () => {
|
|
6
|
+
const View = jest.requireActual("react-native").View;
|
|
7
|
+
|
|
8
|
+
return jest.fn((prop) => <View whoAmI="default renderer" someProp={prop} />);
|
|
9
|
+
});
|
|
8
10
|
|
|
9
11
|
const { CellRendererResolver } = require("../index");
|
|
10
12
|
|
|
@@ -5,22 +5,22 @@ exports[`ComponentResolver renders correctly 1`] = `
|
|
|
5
5
|
value={null}
|
|
6
6
|
>
|
|
7
7
|
<Memo(ComponentResolver)
|
|
8
|
-
cellStyles={
|
|
8
|
+
cellStyles={{}}
|
|
9
9
|
component={
|
|
10
|
-
|
|
10
|
+
{
|
|
11
11
|
"component_type": "some_component",
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
components={
|
|
15
|
-
|
|
15
|
+
{
|
|
16
16
|
"SomeComponent": [MockFunction],
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
decorators={[MockFunction]}
|
|
20
20
|
dispatch={[Function]}
|
|
21
|
-
plugins={
|
|
21
|
+
plugins={[]}
|
|
22
22
|
store={
|
|
23
|
-
|
|
23
|
+
{
|
|
24
24
|
"clearActions": [Function],
|
|
25
25
|
"dispatch": [Function],
|
|
26
26
|
"getActions": [Function],
|
|
@@ -4,19 +4,21 @@ import { shallow } from "enzyme";
|
|
|
4
4
|
import { shallowToJson } from "enzyme-to-json";
|
|
5
5
|
import configureStore from "redux-mock-store";
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const mockLogger = {
|
|
8
8
|
warning: jest.fn(),
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
jest.mock("../../../Helpers/logger", () => ({
|
|
12
12
|
componentsLogger: {
|
|
13
|
-
addSubsystem: jest.fn(() =>
|
|
13
|
+
addSubsystem: jest.fn(() => mockLogger),
|
|
14
14
|
},
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
|
-
jest.mock("../../default-cell-renderer", () =>
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
jest.mock("../../default-cell-renderer", () => {
|
|
18
|
+
const View = jest.requireActual("react-native").View;
|
|
19
|
+
|
|
20
|
+
return jest.fn((prop) => <View whoAmI="default renderer" someProp={prop} />);
|
|
21
|
+
});
|
|
20
22
|
|
|
21
23
|
const mock_rtl_flag = false;
|
|
22
24
|
|
|
@@ -48,7 +50,7 @@ function clearAllMocks() {
|
|
|
48
50
|
SomeComponent.mockClear();
|
|
49
51
|
decorators.mockClear();
|
|
50
52
|
renderFunction.mockClear();
|
|
51
|
-
|
|
53
|
+
mockLogger.warning.mockClear();
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
describe("ComponentResolver", () => {
|
|
@@ -104,16 +106,16 @@ describe("ComponentResolverComponent", () => {
|
|
|
104
106
|
expect(shallowToJson(wrapper)).toMatchSnapshot();
|
|
105
107
|
expect(wrapper.isEmptyRender()).toBe(true);
|
|
106
108
|
|
|
107
|
-
expect(
|
|
109
|
+
expect(mockLogger.warning).toHaveBeenCalledTimes(2);
|
|
108
110
|
|
|
109
|
-
expect(
|
|
111
|
+
expect(mockLogger.warning).toHaveBeenNthCalledWith(
|
|
110
112
|
1,
|
|
111
113
|
expect.objectContaining({
|
|
112
114
|
message: "Could not resolve cell builder plugin",
|
|
113
115
|
})
|
|
114
116
|
);
|
|
115
117
|
|
|
116
|
-
expect(
|
|
118
|
+
expect(mockLogger.warning).toHaveBeenNthCalledWith(
|
|
117
119
|
2,
|
|
118
120
|
expect.objectContaining({
|
|
119
121
|
message: warningMessage,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`DISPLAY_STATES matches the snapshot 1`] = `
|
|
4
|
-
|
|
4
|
+
{
|
|
5
5
|
"CONTENT": "CONTENT",
|
|
6
6
|
"CONTROLS": "CONTROLS",
|
|
7
7
|
"DISCOVERY": "DISCOVERY",
|
|
@@ -9,7 +9,7 @@ Object {
|
|
|
9
9
|
`;
|
|
10
10
|
|
|
11
11
|
exports[`DisplayStateContext has the correct properties 1`] = `
|
|
12
|
-
|
|
12
|
+
{
|
|
13
13
|
"Consumer": [MockFunction],
|
|
14
14
|
"Provider": [MockFunction],
|
|
15
15
|
"withConsumer": [MockFunction],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
import { renderHook } from "@testing-library/react-hooks";
|
|
2
3
|
|
|
3
4
|
import {
|
|
@@ -9,6 +10,51 @@ import {
|
|
|
9
10
|
import * as redux from "react-redux";
|
|
10
11
|
import * as layoutPresets from "@applicaster/zapp-react-native-redux/hooks/useLayoutPresets";
|
|
11
12
|
import * as pipesFeeds from "@applicaster/zapp-react-native-redux/hooks/useZappPipesFeeds";
|
|
13
|
+
import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NavigationContext";
|
|
14
|
+
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
15
|
+
|
|
16
|
+
import { Provider } from "react-redux";
|
|
17
|
+
import configureStore from "redux-mock-store";
|
|
18
|
+
|
|
19
|
+
jest.mock(
|
|
20
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
|
|
21
|
+
() => ({
|
|
22
|
+
useRoute: jest.fn().mockReturnValue({
|
|
23
|
+
pathname: "/home",
|
|
24
|
+
}),
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const homeStack = {
|
|
29
|
+
route: "/home",
|
|
30
|
+
state: {
|
|
31
|
+
screen: { id: "123" },
|
|
32
|
+
entry: { id: "abc" },
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const mainStackNavigator = {
|
|
37
|
+
getStackForPathname: jest.fn().mockReturnValue(homeStack),
|
|
38
|
+
modalState: {
|
|
39
|
+
screen: {
|
|
40
|
+
id: "modal-1",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const store = configureStore()({});
|
|
46
|
+
|
|
47
|
+
const wrapper = ({ children }) => (
|
|
48
|
+
<Provider store={store}>
|
|
49
|
+
<NavigationContext.Provider
|
|
50
|
+
value={{ ...mainStackNavigator, currentRoute: homeStack.route }}
|
|
51
|
+
>
|
|
52
|
+
<PathnameContext.Provider value={homeStack.route}>
|
|
53
|
+
{children}
|
|
54
|
+
</PathnameContext.Provider>
|
|
55
|
+
</NavigationContext.Provider>
|
|
56
|
+
</Provider>
|
|
57
|
+
);
|
|
12
58
|
|
|
13
59
|
describe("getTransformedPreset should return the passed components if smartComponents is empty", () => {
|
|
14
60
|
describe("getTransformedPreset function", () => {
|
|
@@ -94,9 +140,13 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
94
140
|
},
|
|
95
141
|
};
|
|
96
142
|
|
|
143
|
+
const mockUrlsMap = {
|
|
144
|
+
[mockSmartComp.id]: mockSmartComp.data.source,
|
|
145
|
+
};
|
|
146
|
+
|
|
97
147
|
it("should return the component itself if its component_type is not SMART_COMPONENT_TYPE", () => {
|
|
98
148
|
expect(
|
|
99
|
-
enrichComponent(mockComp, 0, mockFeeds, mockLayoutPresets)
|
|
149
|
+
enrichComponent(mockComp, 0, mockFeeds, mockLayoutPresets, mockUrlsMap)
|
|
100
150
|
).toEqual([mockComp]);
|
|
101
151
|
});
|
|
102
152
|
|
|
@@ -106,8 +156,18 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
106
156
|
data: { source: "missing_source" },
|
|
107
157
|
};
|
|
108
158
|
|
|
159
|
+
const missing_source_urls_map = {
|
|
160
|
+
[missing_source_comp.id]: missing_source_comp.data.source,
|
|
161
|
+
};
|
|
162
|
+
|
|
109
163
|
expect(
|
|
110
|
-
enrichComponent(
|
|
164
|
+
enrichComponent(
|
|
165
|
+
missing_source_comp,
|
|
166
|
+
0,
|
|
167
|
+
mockFeeds,
|
|
168
|
+
mockLayoutPresets,
|
|
169
|
+
missing_source_urls_map
|
|
170
|
+
)
|
|
111
171
|
).toEqual(null);
|
|
112
172
|
});
|
|
113
173
|
|
|
@@ -116,7 +176,8 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
116
176
|
mockSmartComp,
|
|
117
177
|
0,
|
|
118
178
|
mockFeeds,
|
|
119
|
-
mockLayoutPresets
|
|
179
|
+
mockLayoutPresets,
|
|
180
|
+
mockUrlsMap
|
|
120
181
|
);
|
|
121
182
|
|
|
122
183
|
expect(Array.isArray(result)).toBe(true);
|
|
@@ -262,7 +323,9 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
262
323
|
|
|
263
324
|
mockUseLayoutPresets.mockReturnValue({});
|
|
264
325
|
|
|
265
|
-
const { result } = renderHook(() => useCurationAPI(mockComponents)
|
|
326
|
+
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
327
|
+
wrapper,
|
|
328
|
+
});
|
|
266
329
|
|
|
267
330
|
// if there are no smart components, it should return the original array
|
|
268
331
|
expect(result.current).toEqual(mockComponents);
|
|
@@ -313,7 +376,9 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
313
376
|
|
|
314
377
|
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
315
378
|
|
|
316
|
-
const { result } = renderHook(() => useCurationAPI(mockComponents)
|
|
379
|
+
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
380
|
+
wrapper,
|
|
381
|
+
});
|
|
317
382
|
|
|
318
383
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
319
384
|
});
|
|
@@ -383,7 +448,9 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
383
448
|
|
|
384
449
|
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
385
450
|
|
|
386
|
-
const { result } = renderHook(() => useCurationAPI(mockComponents)
|
|
451
|
+
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
452
|
+
wrapper,
|
|
453
|
+
});
|
|
387
454
|
|
|
388
455
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
389
456
|
});
|
|
@@ -434,7 +501,9 @@ describe("getTransformedPreset should return the passed components if smartCompo
|
|
|
434
501
|
const mockUseLayoutPresets = jest.spyOn(layoutPresets, "useLayoutPresets");
|
|
435
502
|
mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
|
|
436
503
|
|
|
437
|
-
const { result } = renderHook(() => useCurationAPI(mockComponents)
|
|
504
|
+
const { result } = renderHook(() => useCurationAPI(mockComponents), {
|
|
505
|
+
wrapper,
|
|
506
|
+
});
|
|
438
507
|
|
|
439
508
|
expect(result.current).toEqual(mockTransformedComponents);
|
|
440
509
|
});
|