@applicaster/zapp-react-native-ui-components 16.0.0-alpha.5803191443 → 16.0.0-alpha.6001988150
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/CellRendererResolver/index.ts +1 -1
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +11 -7
- package/Components/Layout/TV/ScreenContainer.tsx +5 -0
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +25 -25
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.tsx +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +7 -7
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +266 -0
- package/Components/Screen/TV/hooks/__tests__/useAfterPaint.test.ts +60 -0
- package/Components/Screen/TV/hooks/index.ts +2 -0
- package/Components/Screen/TV/hooks/useAfterPaint.ts +23 -0
- package/Components/Screen/TV/index.web.tsx +16 -7
- package/Components/VideoLive/LiveImageManager.ts +40 -42
- package/Components/VideoModal/utils.ts +6 -1
- package/package.json +5 -5
- package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +0 -156
|
@@ -83,7 +83,7 @@ export function CellRendererResolver({
|
|
|
83
83
|
|
|
84
84
|
if (!cellRendererPlugin && !isGroup(component)) {
|
|
85
85
|
logger.warning({
|
|
86
|
-
message:
|
|
86
|
+
message: `Could not resolve cell builder plugin: ${component?.component_type}`,
|
|
87
87
|
data: { component },
|
|
88
88
|
});
|
|
89
89
|
}
|
|
@@ -107,7 +107,7 @@ describe("ComponentResolverComponent", () => {
|
|
|
107
107
|
expect(mockLogger.warning).toHaveBeenNthCalledWith(
|
|
108
108
|
1,
|
|
109
109
|
expect.objectContaining({
|
|
110
|
-
message: "Could not resolve cell builder plugin",
|
|
110
|
+
message: "Could not resolve cell builder plugin: foo",
|
|
111
111
|
})
|
|
112
112
|
);
|
|
113
113
|
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { FocusableGroupNative } from "@applicaster/zapp-react-native-ui-components/Components/NativeFocusables";
|
|
3
3
|
import { BaseFocusable } from "@applicaster/zapp-react-native-ui-components/Components/BaseFocusable";
|
|
4
|
-
|
|
4
|
+
// TODO: Enable when will be feature flags
|
|
5
|
+
// import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
5
6
|
import { LayoutContext } from "@applicaster/zapp-react-native-tvos-app/Context/LayoutContext";
|
|
6
7
|
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute";
|
|
7
8
|
import { isScreenPlayable } from "@applicaster/zapp-react-native-utils/navigationUtils/itemTypes";
|
|
8
9
|
import { emitNativeRegistered } from "@applicaster/zapp-react-native-utils/appUtils/focusManagerAux/utils/utils.ios";
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// TODO: Enable when will be feature flags
|
|
12
|
+
// const { log_verbose } = createLogger({
|
|
13
|
+
// subsystem: "General",
|
|
14
|
+
// category: "FocusableGroup",
|
|
15
|
+
// });
|
|
14
16
|
|
|
15
17
|
type FocusableGroupNativeEvent = {
|
|
16
18
|
nativeEvent: {
|
|
@@ -59,12 +61,14 @@ class FocusableGroupComponent extends BaseFocusable<Props> {
|
|
|
59
61
|
} = this.props;
|
|
60
62
|
|
|
61
63
|
const onGroupFocus = ({ nativeEvent }: FocusableGroupNativeEvent) => {
|
|
62
|
-
|
|
64
|
+
// TODO: Enable when will be feature flags
|
|
65
|
+
// log_verbose("FOCUSABLE_GROUP: onGroupFocus", { nativeEvent });
|
|
63
66
|
this.onFocus(this.ref, nativeEvent.focusHeading);
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
const onGroupBlur = ({ nativeEvent }: FocusableGroupNativeEvent) => {
|
|
67
|
-
|
|
70
|
+
// TODO: Enable when will be feature flags
|
|
71
|
+
// log_verbose("FOCUSABLE_GROUP: onGroupBlur", { nativeEvent });
|
|
68
72
|
this.onBlur(this.ref, nativeEvent.focusHeading);
|
|
69
73
|
};
|
|
70
74
|
|
|
@@ -129,6 +129,11 @@ export const ScreenContainer = React.memo(function ScreenContainer({
|
|
|
129
129
|
[]
|
|
130
130
|
);
|
|
131
131
|
|
|
132
|
+
// We need to render menu first and then proceed with screen content,
|
|
133
|
+
// otherwise screen will stay black until everything is loaded and screen
|
|
134
|
+
// rendering put huge load the CPU pushing rendering even further.
|
|
135
|
+
// With this approach, menu will be rendered immediately and screen content
|
|
136
|
+
// will be rendered after paint, which makes it more responsive and prevents black screen.
|
|
132
137
|
const [navBarReady, setNavBarReady] = React.useState(false);
|
|
133
138
|
|
|
134
139
|
const navBarContainer = (
|
|
@@ -4,7 +4,6 @@ import { TouchableOpacity, ViewStyle } from "react-native";
|
|
|
4
4
|
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
5
|
|
|
6
6
|
import Image from "./Image";
|
|
7
|
-
|
|
8
7
|
type Props = {
|
|
9
8
|
item: ZappEntry | ZappFeed;
|
|
10
9
|
flavour?: "flavour_1" | "flavour_2";
|
|
@@ -13,7 +12,7 @@ type Props = {
|
|
|
13
12
|
src: {
|
|
14
13
|
active: string;
|
|
15
14
|
inactive: string;
|
|
16
|
-
}
|
|
15
|
+
} & Record<string, string>;
|
|
17
16
|
style: {};
|
|
18
17
|
type: "Image" | "Svg" | "Lottie";
|
|
19
18
|
};
|
|
@@ -33,21 +32,21 @@ function isStringAsset(asset) {
|
|
|
33
32
|
return typeof asset === "string" || Array.isArray(asset);
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
/** return asset based on the asset, flavour, and fallbackAsset
|
|
37
|
-
* usully fallback asset is set on cell configuration, while the asset is configured on action plugin configuration
|
|
38
|
-
*/
|
|
39
35
|
function getAssetValue(asset, flavour, fallbackAsset = null) {
|
|
40
36
|
if (!asset) {
|
|
41
37
|
return null;
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
if (typeof asset === "string") return asset;
|
|
40
|
+
if (typeof asset === "string") return fallbackAsset || asset;
|
|
45
41
|
|
|
46
42
|
if (Array.isArray(asset)) {
|
|
47
43
|
const flavourIndex = Number(flavour.replace("flavour_", ""));
|
|
48
|
-
if (flavour && flavourIndex > -1) return asset[flavourIndex - 1];
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
if (flavour && flavourIndex > -1) {
|
|
46
|
+
return fallbackAsset || asset[flavourIndex - 1];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return fallbackAsset || asset[0];
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
return asset.src || fallbackAsset;
|
|
@@ -64,33 +63,26 @@ export const ActionButton = React.memo(function ActionButtonComponent(
|
|
|
64
63
|
typeof actionContext?.isActionAvailable === "function" &&
|
|
65
64
|
!actionContext.isActionAvailable(item);
|
|
66
65
|
|
|
67
|
-
const getActionEntryState = useCallback(() => {
|
|
68
|
-
return actionContext.initialEntryState(item, {
|
|
69
|
-
fallbackAssetSrc: asset?.src,
|
|
70
|
-
});
|
|
71
|
-
// eslint-disable-next-line @wogns3623/better-exhaustive-deps/exhaustive-deps
|
|
72
|
-
}, [actionContext, item?.id, asset?.src]);
|
|
73
|
-
|
|
74
66
|
// Note: in theory initialization is not needed anymore, we are using useEffect
|
|
75
67
|
const [actionState, setActionState] = React.useState(
|
|
76
|
-
actionDisabled || !actionContext
|
|
68
|
+
actionDisabled || !actionContext
|
|
69
|
+
? null
|
|
70
|
+
: actionContext.initialEntryState(item)
|
|
77
71
|
);
|
|
78
72
|
|
|
79
73
|
useEffect(() => {
|
|
80
74
|
if (!((actionDisabled || !actionContext) && actionState !== null)) {
|
|
81
|
-
setActionState(
|
|
75
|
+
setActionState(actionContext.initialEntryState(item));
|
|
82
76
|
}
|
|
83
|
-
|
|
84
|
-
}, [actionDisabled, item?.id, actionContext, getActionEntryState]);
|
|
77
|
+
}, [actionDisabled, item?.id, actionContext, action, setActionState]);
|
|
85
78
|
|
|
86
79
|
const onPress = useCallback(() => {
|
|
87
80
|
actionContext.invokeAction(item, {
|
|
88
|
-
updateState: () => {
|
|
89
|
-
setActionState(
|
|
81
|
+
updateState: (state) => {
|
|
82
|
+
setActionState(state);
|
|
90
83
|
},
|
|
91
84
|
});
|
|
92
|
-
|
|
93
|
-
}, [actionContext, item?.id, getActionEntryState]);
|
|
85
|
+
}, [actionState, actionContext?.state, item?.id]);
|
|
94
86
|
|
|
95
87
|
useEffect(() => {
|
|
96
88
|
if (typeof actionContext?.addListener === "function") {
|
|
@@ -120,13 +112,21 @@ export const ActionButton = React.memo(function ActionButtonComponent(
|
|
|
120
112
|
<Image
|
|
121
113
|
fadeDuration={0}
|
|
122
114
|
style={asset?.style || props?.style}
|
|
123
|
-
uri={getAssetValue(
|
|
115
|
+
uri={getAssetValue(
|
|
116
|
+
actionState.asset,
|
|
117
|
+
flavour,
|
|
118
|
+
actionState.state === 1 ? asset?.src.active : asset?.src.inactive
|
|
119
|
+
)}
|
|
124
120
|
{...asset?.props}
|
|
125
121
|
/>
|
|
126
122
|
) : (
|
|
127
123
|
<AssetComponent
|
|
128
124
|
flavour={flavour}
|
|
129
|
-
asset={getAssetValue(
|
|
125
|
+
asset={getAssetValue(
|
|
126
|
+
asset,
|
|
127
|
+
flavour,
|
|
128
|
+
actionState.state === 1 ? asset?.src.active : asset?.src.inactive
|
|
129
|
+
)}
|
|
130
130
|
cellUUID={cellUUID}
|
|
131
131
|
{...(props?.extraProps ?? {})}
|
|
132
132
|
/>
|
|
@@ -265,14 +265,12 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
265
265
|
navigator.goBack();
|
|
266
266
|
}, [isModal, state.playerId, showNavBar, navigator]);
|
|
267
267
|
|
|
268
|
-
const pluginConfiguration = React.useMemo(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
);
|
|
273
|
-
}, [playerManager.isRegistered()]);
|
|
268
|
+
const pluginConfiguration = React.useMemo(
|
|
269
|
+
() => player?.getPluginConfiguration(),
|
|
270
|
+
[player]
|
|
271
|
+
);
|
|
274
272
|
|
|
275
|
-
const playEntry = (entry) => navigator.replaceTop(entry, { mode });
|
|
273
|
+
const playEntry = (entry: ZappEntry) => navigator.replaceTop(entry, { mode });
|
|
276
274
|
|
|
277
275
|
const onPlayNextPerformNextVideoPlay = React.useCallback(() => {
|
|
278
276
|
if (!playNextOverlayState.entry) {
|
|
@@ -468,6 +466,8 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
468
466
|
if (isModal && mode === VideoModalMode.MAXIMIZED) {
|
|
469
467
|
if (disableMiniPlayer) {
|
|
470
468
|
navigator.closeVideoModal();
|
|
469
|
+
} else {
|
|
470
|
+
navigator.minimiseVideoModal();
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
jest.mock(
|
|
5
|
+
"@applicaster/zapp-react-native-utils/appUtils/playerManager",
|
|
6
|
+
() => ({
|
|
7
|
+
playerManager: {
|
|
8
|
+
invokeHandler: jest.fn(),
|
|
9
|
+
getPluginConfiguration: jest.fn(() => ({})),
|
|
10
|
+
isRegistered: jest.fn(() => true),
|
|
11
|
+
on: jest.fn().mockReturnThis(),
|
|
12
|
+
removeHandler: jest.fn().mockReturnThis(),
|
|
13
|
+
getActivePlayer: jest.fn(() => null),
|
|
14
|
+
closeNativePlayer: jest.fn(),
|
|
15
|
+
},
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
|
|
20
|
+
isTV: jest.fn(() => false),
|
|
21
|
+
isAndroidTVPlatform: jest.fn(() => false),
|
|
22
|
+
isTvOSPlatform: jest.fn(() => false),
|
|
23
|
+
platformSelect: jest.fn(({ native }) => native),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
jest.mock("@applicaster/zapp-react-native-utils/playerUtils", () => ({
|
|
27
|
+
isAudioItem: jest.fn(() => false),
|
|
28
|
+
isInlineTV: jest.fn(() => false),
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
jest.mock(
|
|
32
|
+
"@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent",
|
|
33
|
+
() => ({
|
|
34
|
+
TVEventHandlerComponent: ({ children }) => children,
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/utils", () => ({
|
|
39
|
+
usePrevious: jest.fn(),
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => {
|
|
43
|
+
const navigator = {
|
|
44
|
+
closeVideoModal: jest.fn(),
|
|
45
|
+
minimiseVideoModal: jest.fn(),
|
|
46
|
+
maximiseVideoModal: jest.fn(),
|
|
47
|
+
fullscreenVideoModal: jest.fn(),
|
|
48
|
+
isVideoModalDocked: jest.fn(() => false),
|
|
49
|
+
goBack: jest.fn(),
|
|
50
|
+
replaceTop: jest.fn(),
|
|
51
|
+
push: jest.fn(),
|
|
52
|
+
setPlayNextOverlay: jest.fn(),
|
|
53
|
+
currentRoute: "/playable/entry-1",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const backHandlerRef: { current: (() => boolean) | null } = {
|
|
57
|
+
current: null,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
useBackHandler: jest.fn((cb) => {
|
|
62
|
+
backHandlerRef.current = cb;
|
|
63
|
+
}),
|
|
64
|
+
useNavigation: jest.fn(() => navigator),
|
|
65
|
+
__navigator: navigator,
|
|
66
|
+
__backHandlerRef: backHandlerRef,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
jest.mock("@applicaster/zapp-react-native-bridge/QuickBrick", () => ({
|
|
71
|
+
QUICK_BRICK_EVENTS: {
|
|
72
|
+
IDLE_TIMER_DISABLED: "IDLE_TIMER_DISABLED",
|
|
73
|
+
MOVE_APP_TO_BACKGROUND: "MOVE_APP_TO_BACKGROUND",
|
|
74
|
+
},
|
|
75
|
+
sendQuickBrickEvent: jest.fn(),
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
jest.mock("../ProgramInfo", () => ({
|
|
79
|
+
ProgramInfo: () => null,
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
jest.mock("../../AudioPlayer", () => ({
|
|
83
|
+
AudioPlayer: () => null,
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
jest.mock("../logger", () => ({
|
|
87
|
+
log_debug: jest.fn(),
|
|
88
|
+
log_info: jest.fn(),
|
|
89
|
+
log_warning: jest.fn(),
|
|
90
|
+
playerContainerLogger: { error: jest.fn() },
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
jest.mock(
|
|
94
|
+
"@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer",
|
|
95
|
+
() => ({
|
|
96
|
+
usePlayer: jest.fn(() => ({
|
|
97
|
+
addListener: jest.fn(),
|
|
98
|
+
removeListener: jest.fn(),
|
|
99
|
+
isPaused: jest.fn(() => false),
|
|
100
|
+
isAd: jest.fn(() => false),
|
|
101
|
+
seekTo: jest.fn(),
|
|
102
|
+
getOverlayObservable: jest.fn(() => ({ getPlayNextEntry: () => null })),
|
|
103
|
+
})),
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
jest.mock(
|
|
108
|
+
"@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayNextOverlay",
|
|
109
|
+
() => ({
|
|
110
|
+
usePlayNextOverlay: jest.fn(() => null),
|
|
111
|
+
})
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
jest.mock(
|
|
115
|
+
"@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand",
|
|
116
|
+
() => ({
|
|
117
|
+
PlayerNativeCommandTypes: { clearPlayerData: "clearPlayerData" },
|
|
118
|
+
PlayerNativeSendCommand: jest.fn(),
|
|
119
|
+
})
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
jest.mock(
|
|
123
|
+
"@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext",
|
|
124
|
+
() => ({
|
|
125
|
+
useSetNavbarState: jest.fn(() => ({ setVisible: jest.fn() })),
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
jest.mock(
|
|
130
|
+
"@applicaster/zapp-react-native-utils/reactHooks/screen/useTargetScreenData",
|
|
131
|
+
() => ({
|
|
132
|
+
useTargetScreenData: jest.fn(() => ({ id: "screen-id", styles: {} })),
|
|
133
|
+
})
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
jest.mock("../PlayerContainerContext", () => {
|
|
137
|
+
const ReactActual = require("react");
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
PlayerContainerContext: ReactActual.createContext({
|
|
141
|
+
isLanguageOverlayVisible: false,
|
|
142
|
+
bottomFocusableId: "bottom",
|
|
143
|
+
showComponentsContainer: false,
|
|
144
|
+
refs: null,
|
|
145
|
+
}),
|
|
146
|
+
PlayerContainerContextProvider: ({ children }) => children,
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
jest.mock(
|
|
151
|
+
"@applicaster/zapp-react-native-ui-components/Components/FocusableGroup",
|
|
152
|
+
() => ({
|
|
153
|
+
FocusableGroup: ({ children }) => children,
|
|
154
|
+
})
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
jest.mock("../WappersView/PlayerFocusableWrapperView", () => ({
|
|
158
|
+
PlayerFocusableWrapperView: ({ children }) => children,
|
|
159
|
+
}));
|
|
160
|
+
|
|
161
|
+
jest.mock("../WappersView/ComponentFocusableWrapperView", () => ({
|
|
162
|
+
ComponentFocusableWrapperView: () => null,
|
|
163
|
+
}));
|
|
164
|
+
|
|
165
|
+
jest.mock("../index", () => ({
|
|
166
|
+
FocusableGroupMainContainerId: "player-container-general",
|
|
167
|
+
}));
|
|
168
|
+
|
|
169
|
+
jest.mock(
|
|
170
|
+
"@applicaster/zapp-react-native-utils/navigationUtils/itemTypeMatchers",
|
|
171
|
+
() => ({
|
|
172
|
+
isPlayable: jest.fn(() => true),
|
|
173
|
+
})
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
jest.mock("../../GeneralContentScreen", () => ({
|
|
177
|
+
GeneralContentScreen: () => null,
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
jest.mock("@applicaster/zapp-react-native-redux", () => ({
|
|
181
|
+
useAppData: jest.fn(() => ({ isTabletPortrait: false })),
|
|
182
|
+
}));
|
|
183
|
+
|
|
184
|
+
import { PlayerContainer, VideoModalMode } from "../PlayerContainer";
|
|
185
|
+
|
|
186
|
+
const { __navigator: mockNavigator, __backHandlerRef: mockBackHandlerRef } =
|
|
187
|
+
jest.requireMock("@applicaster/zapp-react-native-utils/reactHooks");
|
|
188
|
+
|
|
189
|
+
const { playerManager: mockPlayerManager } = jest.requireMock(
|
|
190
|
+
"@applicaster/zapp-react-native-utils/appUtils/playerManager"
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
const Player = React.forwardRef(() => null);
|
|
194
|
+
|
|
195
|
+
const item = {
|
|
196
|
+
id: "entry-1",
|
|
197
|
+
title: "Test entry",
|
|
198
|
+
summary: "",
|
|
199
|
+
content: { src: "https://example.com/video.m3u8" },
|
|
200
|
+
extensions: {},
|
|
201
|
+
} as any;
|
|
202
|
+
|
|
203
|
+
const renderPlayerContainer = (props = {}) =>
|
|
204
|
+
render(
|
|
205
|
+
<PlayerContainer
|
|
206
|
+
Player={Player}
|
|
207
|
+
item={item}
|
|
208
|
+
style={{}}
|
|
209
|
+
loadPipesData={jest.fn()}
|
|
210
|
+
isModal={true}
|
|
211
|
+
mode={VideoModalMode.MAXIMIZED}
|
|
212
|
+
{...props}
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
const pressHardwareBack = () => {
|
|
217
|
+
if (!mockBackHandlerRef.current) {
|
|
218
|
+
throw new Error("back handler was not registered via useBackHandler");
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return mockBackHandlerRef.current();
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
describe("PlayerContainer hardware back handling", () => {
|
|
225
|
+
beforeEach(() => {
|
|
226
|
+
jest.clearAllMocks();
|
|
227
|
+
mockBackHandlerRef.current = null;
|
|
228
|
+
mockPlayerManager.getPluginConfiguration.mockReturnValue({});
|
|
229
|
+
mockPlayerManager.on.mockReturnThis();
|
|
230
|
+
mockPlayerManager.removeHandler.mockReturnThis();
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("minimises the video modal on back press when mini player is enabled", () => {
|
|
234
|
+
renderPlayerContainer();
|
|
235
|
+
|
|
236
|
+
const handled = pressHardwareBack();
|
|
237
|
+
|
|
238
|
+
expect(mockNavigator.minimiseVideoModal).toHaveBeenCalled();
|
|
239
|
+
expect(mockNavigator.closeVideoModal).not.toHaveBeenCalled();
|
|
240
|
+
expect(handled).toBe(true);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("closes the video modal on back press when mini player is disabled", () => {
|
|
244
|
+
mockPlayerManager.getPluginConfiguration.mockReturnValue({
|
|
245
|
+
disable_mini_player_when_inline: true,
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
renderPlayerContainer();
|
|
249
|
+
|
|
250
|
+
const handled = pressHardwareBack();
|
|
251
|
+
|
|
252
|
+
expect(mockNavigator.closeVideoModal).toHaveBeenCalled();
|
|
253
|
+
expect(mockNavigator.minimiseVideoModal).not.toHaveBeenCalled();
|
|
254
|
+
expect(handled).toBe(true);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it("does not handle back press when the player is already minimised", () => {
|
|
258
|
+
renderPlayerContainer({ mode: VideoModalMode.MINIMIZED });
|
|
259
|
+
|
|
260
|
+
const handled = pressHardwareBack();
|
|
261
|
+
|
|
262
|
+
expect(handled).toBe(false);
|
|
263
|
+
expect(mockNavigator.minimiseVideoModal).not.toHaveBeenCalled();
|
|
264
|
+
expect(mockNavigator.closeVideoModal).not.toHaveBeenCalled();
|
|
265
|
+
});
|
|
266
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { renderHook, act } from "@testing-library/react-native";
|
|
2
|
+
|
|
3
|
+
import { useAfterPaint } from "../useAfterPaint";
|
|
4
|
+
|
|
5
|
+
describe("useAfterPaint", () => {
|
|
6
|
+
let frameCallbacks: FrameRequestCallback[];
|
|
7
|
+
let originalRaf: typeof requestAnimationFrame;
|
|
8
|
+
let originalCancelRaf: typeof cancelAnimationFrame;
|
|
9
|
+
|
|
10
|
+
const flushFrame = () => {
|
|
11
|
+
const callbacks = frameCallbacks;
|
|
12
|
+
frameCallbacks = [];
|
|
13
|
+
|
|
14
|
+
act(() => {
|
|
15
|
+
callbacks.forEach((cb) => cb(0));
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
frameCallbacks = [];
|
|
21
|
+
originalRaf = global.requestAnimationFrame;
|
|
22
|
+
originalCancelRaf = global.cancelAnimationFrame;
|
|
23
|
+
|
|
24
|
+
global.requestAnimationFrame = jest.fn((cb: FrameRequestCallback) => {
|
|
25
|
+
frameCallbacks.push(cb);
|
|
26
|
+
|
|
27
|
+
return frameCallbacks.length;
|
|
28
|
+
}) as unknown as typeof requestAnimationFrame;
|
|
29
|
+
|
|
30
|
+
global.cancelAnimationFrame = jest.fn();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
global.requestAnimationFrame = originalRaf;
|
|
35
|
+
global.cancelAnimationFrame = originalCancelRaf;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("returns false on the initial render", () => {
|
|
39
|
+
const { result } = renderHook(() => useAfterPaint());
|
|
40
|
+
|
|
41
|
+
expect(result.current).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("stays false after only one animation frame (before paint completes)", () => {
|
|
45
|
+
const { result } = renderHook(() => useAfterPaint());
|
|
46
|
+
|
|
47
|
+
flushFrame();
|
|
48
|
+
|
|
49
|
+
expect(result.current).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("returns true after two animation frames (a real post-paint boundary)", () => {
|
|
53
|
+
const { result } = renderHook(() => useAfterPaint());
|
|
54
|
+
|
|
55
|
+
flushFrame();
|
|
56
|
+
flushFrame();
|
|
57
|
+
|
|
58
|
+
expect(result.current).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
export const useAfterPaint = (): boolean => {
|
|
4
|
+
const [painted, setPainted] = React.useState(false);
|
|
5
|
+
|
|
6
|
+
React.useEffect(() => {
|
|
7
|
+
let secondFrame: number | undefined;
|
|
8
|
+
|
|
9
|
+
const firstFrame = requestAnimationFrame(() => {
|
|
10
|
+
secondFrame = requestAnimationFrame(() => setPainted(true));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
return () => {
|
|
14
|
+
cancelAnimationFrame(firstFrame);
|
|
15
|
+
|
|
16
|
+
if (secondFrame !== undefined) {
|
|
17
|
+
cancelAnimationFrame(secondFrame);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return painted;
|
|
23
|
+
};
|
|
@@ -21,7 +21,7 @@ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/he
|
|
|
21
21
|
|
|
22
22
|
import { NavBarContainer } from "../../Layout/TV/NavBarContainer";
|
|
23
23
|
import { ScreenResolver } from "../../ScreenResolver";
|
|
24
|
-
import { useInitialFocus } from "./hooks";
|
|
24
|
+
import { useInitialFocus, useAfterPaint } from "./hooks";
|
|
25
25
|
import { isPlayerPlugin } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
26
26
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
27
27
|
import { FreezeWithCallback } from "../../FreezeWithCallback";
|
|
@@ -157,6 +157,13 @@ export const Screen = ({ route, Components }: Props) => {
|
|
|
157
157
|
|
|
158
158
|
const isScreenActive = useIsScreenActive();
|
|
159
159
|
|
|
160
|
+
// We need to render menu first and then proceed with screen content,
|
|
161
|
+
// otherwise screen will stay black until everything is loaded and screen
|
|
162
|
+
// rendering put huge load the CPU pushing rendering even further.
|
|
163
|
+
// With this approach, menu will be rendered immediately and screen content
|
|
164
|
+
// will be rendered after paint, which makes it more responsive and prevents black screen.
|
|
165
|
+
const isContentReady = useAfterPaint();
|
|
166
|
+
|
|
160
167
|
return (
|
|
161
168
|
<FreezeWithCallback freeze={!isScreenActive} onRelease={onRelease}>
|
|
162
169
|
<View style={[styles.container, { backgroundColor }]}>
|
|
@@ -167,12 +174,14 @@ export const Screen = ({ route, Components }: Props) => {
|
|
|
167
174
|
navigationProps={navigationProps}
|
|
168
175
|
/>
|
|
169
176
|
</NavBarContainer>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
{isContentReady ? (
|
|
178
|
+
<ScreenResolver
|
|
179
|
+
screenType={screenType}
|
|
180
|
+
screenId={screenId}
|
|
181
|
+
screenData={screenData}
|
|
182
|
+
groupId={route}
|
|
183
|
+
/>
|
|
184
|
+
) : null}
|
|
176
185
|
</View>
|
|
177
186
|
</FreezeWithCallback>
|
|
178
187
|
);
|
|
@@ -624,48 +624,7 @@ export class LiveImage implements QuickBrickPlayer.SharedPlayerCallBacks {
|
|
|
624
624
|
return this._preparePromise;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
-
this._preparePromise = (
|
|
628
|
-
// 1. Run hooks if configured
|
|
629
|
-
let entry = this.factoryConfig.entry;
|
|
630
|
-
|
|
631
|
-
if (this.preloadHooks?.length) {
|
|
632
|
-
const result = await executePreloadHooks({
|
|
633
|
-
preloadHooks: this.preloadHooks,
|
|
634
|
-
entry,
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
if (result) {
|
|
638
|
-
this.processedEntry = result;
|
|
639
|
-
entry = result;
|
|
640
|
-
} else {
|
|
641
|
-
return false;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
// 2. Create the player with the correct entry
|
|
646
|
-
const factoryItem = playerFactory({
|
|
647
|
-
player: this.factoryConfig.player,
|
|
648
|
-
playerId: this.factoryConfig.playerId,
|
|
649
|
-
autoplay: false,
|
|
650
|
-
entry,
|
|
651
|
-
muted: this.initiallyMuted,
|
|
652
|
-
playerPluginId: this.factoryConfig.playerPluginId,
|
|
653
|
-
screenConfig: this.factoryConfig.screenConfig,
|
|
654
|
-
playerRole: PlayerRole.Cell,
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
if (!factoryItem) {
|
|
658
|
-
throw new Error("Player factory returned null");
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
this.player = factoryItem.controller;
|
|
662
|
-
this.component = factoryItem.Component;
|
|
663
|
-
|
|
664
|
-
// 3. Register callbacks — player now exists
|
|
665
|
-
this.player.addListener({ id: "live-image", listener: this });
|
|
666
|
-
|
|
667
|
-
return true;
|
|
668
|
-
})()
|
|
627
|
+
this._preparePromise = this.createPreparedPlayer()
|
|
669
628
|
.then((result) => {
|
|
670
629
|
this._preparePromise = null;
|
|
671
630
|
|
|
@@ -685,6 +644,45 @@ export class LiveImage implements QuickBrickPlayer.SharedPlayerCallBacks {
|
|
|
685
644
|
return this._preparePromise;
|
|
686
645
|
}
|
|
687
646
|
|
|
647
|
+
private async createPreparedPlayer(): Promise<boolean> {
|
|
648
|
+
let entry = this.factoryConfig.entry;
|
|
649
|
+
|
|
650
|
+
if (this.preloadHooks?.length) {
|
|
651
|
+
const result = await executePreloadHooks({
|
|
652
|
+
preloadHooks: this.preloadHooks,
|
|
653
|
+
entry,
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
if (!result) return false;
|
|
657
|
+
|
|
658
|
+
this.processedEntry = result;
|
|
659
|
+
entry = result;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const factoryItem = await playerFactory({
|
|
663
|
+
player: this.factoryConfig.player,
|
|
664
|
+
playerId: this.factoryConfig.playerId,
|
|
665
|
+
autoplay: false,
|
|
666
|
+
entry,
|
|
667
|
+
muted: this.initiallyMuted,
|
|
668
|
+
playerPluginId: this.factoryConfig.playerPluginId,
|
|
669
|
+
screenConfig: this.factoryConfig.screenConfig,
|
|
670
|
+
playerRole: PlayerRole.Cell,
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
if (!factoryItem) {
|
|
674
|
+
throw new Error(
|
|
675
|
+
`Player factory returned null (playerId: ${this.factoryConfig.playerId}, playerPluginId: ${this.factoryConfig.playerPluginId})`
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
this.player = factoryItem.controller;
|
|
680
|
+
this.component = factoryItem.Component;
|
|
681
|
+
this.player.addListener({ id: "live-image", listener: this });
|
|
682
|
+
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
|
|
688
686
|
public getPlayer = (): Player | null => {
|
|
689
687
|
return this.player;
|
|
690
688
|
};
|
|
@@ -10,6 +10,7 @@ import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
|
10
10
|
import { create } from "zustand";
|
|
11
11
|
import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
12
|
import { selectPluginConfigurationsByPluginId } from "@applicaster/zapp-react-native-redux";
|
|
13
|
+
import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
|
|
13
14
|
|
|
14
15
|
export const useConfiguration = () => {
|
|
15
16
|
const {
|
|
@@ -18,6 +19,7 @@ export const useConfiguration = () => {
|
|
|
18
19
|
|
|
19
20
|
const rivers = useRivers();
|
|
20
21
|
const contentTypes = useContentTypes();
|
|
22
|
+
const player = usePlayer();
|
|
21
23
|
|
|
22
24
|
const targetScreenId = contentTypes?.[item?.type?.value]?.screen_id;
|
|
23
25
|
const targetScreenConfiguration = rivers?.[targetScreenId];
|
|
@@ -26,7 +28,10 @@ export const useConfiguration = () => {
|
|
|
26
28
|
selectPluginConfigurationsByPluginId(state, targetScreenConfiguration?.type)
|
|
27
29
|
);
|
|
28
30
|
|
|
29
|
-
const playerPluginConfig =
|
|
31
|
+
const playerPluginConfig =
|
|
32
|
+
player?.getPluginConfiguration() ??
|
|
33
|
+
playerManager.getInstanceController()?.getPluginConfiguration() ??
|
|
34
|
+
{};
|
|
30
35
|
|
|
31
36
|
const config = mergeRight(playerPluginConfig, {
|
|
32
37
|
...configuration_json,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "16.0.0-alpha.
|
|
3
|
+
"version": "16.0.0-alpha.6001988150",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "16.0.0-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "16.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "16.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "16.0.0-alpha.6001988150",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "16.0.0-alpha.6001988150",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "16.0.0-alpha.6001988150",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-alpha.6001988150",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import { act, fireEvent, render } from "@testing-library/react-native";
|
|
4
|
-
import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
|
|
5
|
-
|
|
6
|
-
import { ActionButton } from "../ActionButton";
|
|
7
|
-
|
|
8
|
-
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/actions", () => ({
|
|
9
|
-
useActions: jest.fn(),
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
jest.mock("../Image", () => {
|
|
13
|
-
const React = require("react");
|
|
14
|
-
const { Text } = require("react-native");
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
__esModule: true,
|
|
18
|
-
default: ({ uri }: { uri: string }) =>
|
|
19
|
-
React.createElement(Text, { testID: "action-button-image" }, uri),
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const mockUseActions = useActions as jest.Mock;
|
|
24
|
-
|
|
25
|
-
const item = { id: "entry-1" } as ZappEntry;
|
|
26
|
-
|
|
27
|
-
const fallbackAsset = {
|
|
28
|
-
props: {},
|
|
29
|
-
src: {
|
|
30
|
-
active: "cell-active.png",
|
|
31
|
-
inactive: "cell-inactive.png",
|
|
32
|
-
},
|
|
33
|
-
style: {},
|
|
34
|
-
type: "Image" as const,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
function renderActionButton(actionContext: any, props = {}) {
|
|
38
|
-
mockUseActions.mockReturnValue(actionContext);
|
|
39
|
-
|
|
40
|
-
return render(
|
|
41
|
-
<ActionButton
|
|
42
|
-
item={item}
|
|
43
|
-
action={{ identifier: "test-action" }}
|
|
44
|
-
asset={fallbackAsset}
|
|
45
|
-
flavour="flavour_1"
|
|
46
|
-
style={{ width: 40, height: 40 }}
|
|
47
|
-
testID="action-button"
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
describe("ActionButton", () => {
|
|
54
|
-
beforeEach(() => {
|
|
55
|
-
jest.clearAllMocks();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("passes cell fallback assets to initialEntryState", () => {
|
|
59
|
-
const actionContext = {
|
|
60
|
-
initialEntryState: jest.fn(() => ({ asset: ["action-1", "action-2"] })),
|
|
61
|
-
invokeAction: jest.fn(),
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
renderActionButton(actionContext);
|
|
65
|
-
|
|
66
|
-
expect(actionContext.initialEntryState).toHaveBeenCalledWith(item, {
|
|
67
|
-
fallbackAssetSrc: fallbackAsset.src,
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("refreshes entry state when invokeAction calls updateState", () => {
|
|
72
|
-
let stateAsset = ["initial-1.png", "initial-2.png"];
|
|
73
|
-
|
|
74
|
-
const actionContext = {
|
|
75
|
-
initialEntryState: jest.fn(() => ({ asset: stateAsset })),
|
|
76
|
-
invokeAction: jest.fn((_entry, options) => {
|
|
77
|
-
stateAsset = ["recomputed-1.png", "recomputed-2.png"];
|
|
78
|
-
options.updateState({ asset: ["ignored-1.png", "ignored-2.png"] });
|
|
79
|
-
}),
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const { getByTestId, getByText, queryByText } =
|
|
83
|
-
renderActionButton(actionContext);
|
|
84
|
-
|
|
85
|
-
fireEvent.press(getByTestId("action-button"));
|
|
86
|
-
|
|
87
|
-
expect(actionContext.invokeAction).toHaveBeenCalledWith(
|
|
88
|
-
item,
|
|
89
|
-
expect.objectContaining({ updateState: expect.any(Function) })
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
expect(getByText("recomputed-1.png")).toBeTruthy();
|
|
93
|
-
expect(queryByText("ignored-1.png")).toBeNull();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("updates entry state from addListener", () => {
|
|
97
|
-
let listener: (state: unknown) => void;
|
|
98
|
-
|
|
99
|
-
const actionContext = {
|
|
100
|
-
initialEntryState: jest.fn(() => ({ asset: ["initial-1.png"] })),
|
|
101
|
-
invokeAction: jest.fn(),
|
|
102
|
-
addListener: jest.fn((_entryId, callback) => {
|
|
103
|
-
listener = callback;
|
|
104
|
-
|
|
105
|
-
return jest.fn();
|
|
106
|
-
}),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
const { getByText } = renderActionButton(actionContext);
|
|
110
|
-
|
|
111
|
-
act(() => {
|
|
112
|
-
listener({ asset: ["listener-1.png"] });
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
expect(actionContext.addListener).toHaveBeenCalledWith(
|
|
116
|
-
String(item.id),
|
|
117
|
-
expect.any(Function)
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
expect(getByText("listener-1.png")).toBeTruthy();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("renders selected flavour from action state asset arrays", () => {
|
|
124
|
-
const actionContext = {
|
|
125
|
-
initialEntryState: jest.fn(() => ({
|
|
126
|
-
asset: ["flavour-1.png", "flavour-2.png"],
|
|
127
|
-
})),
|
|
128
|
-
invokeAction: jest.fn(),
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const { getByText } = renderActionButton(actionContext, {
|
|
132
|
-
flavour: "flavour_2",
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
expect(getByText("flavour-2.png")).toBeTruthy();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("passes fallback cell asset to component assets", () => {
|
|
139
|
-
const AssetComponent = jest.fn(() => <View testID="component-asset" />);
|
|
140
|
-
|
|
141
|
-
const actionContext = {
|
|
142
|
-
initialEntryState: jest.fn(() => ({ asset: AssetComponent })),
|
|
143
|
-
invokeAction: jest.fn(),
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
renderActionButton(actionContext);
|
|
147
|
-
|
|
148
|
-
expect(AssetComponent).toHaveBeenCalledWith(
|
|
149
|
-
expect.objectContaining({
|
|
150
|
-
asset: fallbackAsset.src,
|
|
151
|
-
flavour: "flavour_1",
|
|
152
|
-
}),
|
|
153
|
-
expect.anything()
|
|
154
|
-
);
|
|
155
|
-
});
|
|
156
|
-
});
|