Skip to content

Commit 78b5ca1

Browse files
author
Harun.Karahan
committed
fixed unit tests
1 parent 77f2d64 commit 78b5ca1

File tree

10 files changed

+4102
-461
lines changed

10 files changed

+4102
-461
lines changed

packages/pluggableWidgets/bottom-sheet-native/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"@mendix/piw-utils-internal": "*",
2525
"@shopify/flash-list": "1.7.3",
2626
"react-native-device-info": "13.0.0",
27-
"react-native-gesture-handler": "2.24.0"
27+
"react-native-gesture-handler": "2.24.0",
28+
"react-native-reanimated": "3.16.1"
2829
},
2930
"devDependencies": {
3031
"@mendix/pluggable-widgets-tools": "~10.0.1",

packages/pluggableWidgets/bottom-sheet-native/src/__tests__/BottomSheet.spec.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ jest.mock("react-native/Libraries/Utilities/Platform", () => ({
1515
select: jest.fn(dict => dict.ios)
1616
}));
1717

18-
jest.mock("react-native-reanimated", () => jest.requireActual("react-native-reanimated/mock"));
19-
2018
const defaultProps: BottomSheetProps<BottomSheetStyle> = {
2119
name: "bottom-sheet-test",
2220
style: [],

packages/pluggableWidgets/bottom-sheet-native/src/__tests__/__snapshots__/BottomSheet.spec.tsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ exports[`Bottom sheet renders a expanding fullscreen with custom styles 1`] = `
103103
</View>
104104
`;
105105

106-
exports[`Bottom sheet renders a native bottom action sheet for ios (Basic modal) 1`] = `null`;
106+
exports[`Bottom sheet renders a native bottom action sheet for ios (Basic modal) 1`] = `<View />`;

packages/pluggableWidgets/bottom-sheet-native/src/components/NativeBottomSheet.tsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ export const NativeBottomSheet = (props: NativeBottomSheetProps): ReactElement =
3535
props.triggerAttribute.status === ValueStatus.Available &&
3636
props.triggerAttribute.value;
3737

38+
const manageBottomSheet = () => {
39+
if (props.triggerAttribute && props.triggerAttribute.status === ValueStatus.Available) {
40+
if (props.triggerAttribute.value) {
41+
bottomSheetRef.current?.expand();
42+
} else {
43+
bottomSheetRef.current?.close();
44+
}
45+
}
46+
};
47+
3848
useEffect(() => {
3949
manageBottomSheet();
4050
}, [props.triggerAttribute]);
@@ -68,16 +78,6 @@ export const NativeBottomSheet = (props: NativeBottomSheetProps): ReactElement =
6878
}
6979
}, [isOpen]);
7080

71-
const manageBottomSheet = () => {
72-
if (props.triggerAttribute && props.triggerAttribute.status === ValueStatus.Available) {
73-
if (props.triggerAttribute.value) {
74-
bottomSheetRef.current?.expand();
75-
} else {
76-
bottomSheetRef.current?.close();
77-
}
78-
}
79-
};
80-
8181
const renderBackdrop = (backdropProps: BottomSheetBackdropProps) => (
8282
<Pressable style={{ flex: 1 }} onPress={close}>
8383
<BottomSheetBackdrop

packages/pluggableWidgets/signature-native/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@mendix/piw-native-utils-internal": "*",
2929
"@mendix/piw-utils-internal": "*",
3030
"react-native-signature-canvas": "3.4.0",
31-
"react-native-webview": "13.13.2"
31+
"react-native-webview": "13.8.6"
3232
},
3333
"devDependencies": {
3434
"@mendix/pluggable-widgets-tools": "~10.0.1",

packages/pluggableWidgets/signature-native/src/__tests__/__snapshots__/Signature.android.spec.tsx.snap

+1,993-191
Large diffs are not rendered by default.

packages/pluggableWidgets/signature-native/src/__tests__/__snapshots__/Signature.ios.spec.tsx.snap

+2,031-229
Large diffs are not rendered by default.

packages/pluggableWidgets/web-view-native/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"dependencies": {
2828
"@mendix/piw-native-utils-internal": "*",
2929
"@mendix/piw-utils-internal": "*",
30-
"react-native-webview": "13.13.2"
30+
"react-native-webview": "13.8.6"
3131
},
3232
"devDependencies": {
3333
"@mendix/pluggable-widgets-tools": "~10.0.1",

packages/pluggableWidgets/web-view-native/src/__tests__/__snapshots__/WebView.spec.tsx.snap

+16-2
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,26 @@ exports[`WebView renders a web view when a url is provided 1`] = `
2525
<RNCWebView
2626
allowFileAccess={false}
2727
allowsFullscreenVideo={false}
28-
androidHardwareAccelerationDisabled={false}
2928
androidLayerType="none"
3029
cacheEnabled={true}
30+
hasOnOpenWindowEvent={false}
31+
hasOnScroll={false}
3132
javaScriptEnabled={true}
3233
messagingEnabled={true}
3334
messagingModuleName="WebViewMessageHandler1"
3435
nestedScrollEnabled={false}
36+
newSource={
37+
{
38+
"uri": "https://mendix.com",
39+
}
40+
}
3541
onHttpError={[Function]}
3642
onLoadingError={[Function]}
3743
onLoadingFinish={[Function]}
3844
onLoadingProgress={[Function]}
3945
onLoadingStart={[Function]}
4046
onMessage={[Function]}
47+
onOpenWindow={[Function]}
4148
onRenderProcessGone={[Function]}
4249
onShouldStartLoadWithRequest={[Function]}
4350
overScrollMode="always"
@@ -98,19 +105,26 @@ exports[`WebView renders a web view when html content is provided 1`] = `
98105
<RNCWebView
99106
allowFileAccess={false}
100107
allowsFullscreenVideo={false}
101-
androidHardwareAccelerationDisabled={false}
102108
androidLayerType="none"
103109
cacheEnabled={true}
110+
hasOnOpenWindowEvent={false}
111+
hasOnScroll={false}
104112
javaScriptEnabled={true}
105113
messagingEnabled={true}
106114
messagingModuleName="WebViewMessageHandler2"
107115
nestedScrollEnabled={false}
116+
newSource={
117+
{
118+
"html": "Hello, world!",
119+
}
120+
}
108121
onHttpError={[Function]}
109122
onLoadingError={[Function]}
110123
onLoadingFinish={[Function]}
111124
onLoadingProgress={[Function]}
112125
onLoadingStart={[Function]}
113126
onMessage={[Function]}
127+
onOpenWindow={[Function]}
114128
onRenderProcessGone={[Function]}
115129
onShouldStartLoadWithRequest={[Function]}
116130
overScrollMode="always"

yarn.lock

+47-23
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ __metadata:
780780
languageName: node
781781
linkType: hard
782782

783-
"@babel/plugin-transform-arrow-functions@npm:^7.0.0, @babel/plugin-transform-arrow-functions@npm:^7.25.9":
783+
"@babel/plugin-transform-arrow-functions@npm:^7.0.0, @babel/plugin-transform-arrow-functions@npm:^7.0.0-0, @babel/plugin-transform-arrow-functions@npm:^7.25.9":
784784
version: 7.25.9
785785
resolution: "@babel/plugin-transform-arrow-functions@npm:7.25.9"
786786
dependencies:
@@ -839,7 +839,7 @@ __metadata:
839839
languageName: node
840840
linkType: hard
841841

842-
"@babel/plugin-transform-class-properties@npm:^7.24.1, @babel/plugin-transform-class-properties@npm:^7.25.9":
842+
"@babel/plugin-transform-class-properties@npm:^7.0.0-0, @babel/plugin-transform-class-properties@npm:^7.24.1, @babel/plugin-transform-class-properties@npm:^7.25.9":
843843
version: 7.25.9
844844
resolution: "@babel/plugin-transform-class-properties@npm:7.25.9"
845845
dependencies:
@@ -863,7 +863,7 @@ __metadata:
863863
languageName: node
864864
linkType: hard
865865

866-
"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.25.9":
866+
"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.0.0-0, @babel/plugin-transform-classes@npm:^7.25.9":
867867
version: 7.25.9
868868
resolution: "@babel/plugin-transform-classes@npm:7.25.9"
869869
dependencies:
@@ -1124,7 +1124,7 @@ __metadata:
11241124
languageName: node
11251125
linkType: hard
11261126

1127-
"@babel/plugin-transform-nullish-coalescing-operator@npm:^7.24.1, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.26.6":
1127+
"@babel/plugin-transform-nullish-coalescing-operator@npm:^7.0.0-0, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.24.1, @babel/plugin-transform-nullish-coalescing-operator@npm:^7.26.6":
11281128
version: 7.26.6
11291129
resolution: "@babel/plugin-transform-nullish-coalescing-operator@npm:7.26.6"
11301130
dependencies:
@@ -1182,7 +1182,7 @@ __metadata:
11821182
languageName: node
11831183
linkType: hard
11841184

1185-
"@babel/plugin-transform-optional-chaining@npm:^7.24.5, @babel/plugin-transform-optional-chaining@npm:^7.25.9":
1185+
"@babel/plugin-transform-optional-chaining@npm:^7.0.0-0, @babel/plugin-transform-optional-chaining@npm:^7.24.5, @babel/plugin-transform-optional-chaining@npm:^7.25.9":
11861186
version: 7.25.9
11871187
resolution: "@babel/plugin-transform-optional-chaining@npm:7.25.9"
11881188
dependencies:
@@ -1363,7 +1363,7 @@ __metadata:
13631363
languageName: node
13641364
linkType: hard
13651365

1366-
"@babel/plugin-transform-shorthand-properties@npm:^7.0.0, @babel/plugin-transform-shorthand-properties@npm:^7.25.9":
1366+
"@babel/plugin-transform-shorthand-properties@npm:^7.0.0, @babel/plugin-transform-shorthand-properties@npm:^7.0.0-0, @babel/plugin-transform-shorthand-properties@npm:^7.25.9":
13671367
version: 7.25.9
13681368
resolution: "@babel/plugin-transform-shorthand-properties@npm:7.25.9"
13691369
dependencies:
@@ -1397,7 +1397,7 @@ __metadata:
13971397
languageName: node
13981398
linkType: hard
13991399

1400-
"@babel/plugin-transform-template-literals@npm:^7.26.8":
1400+
"@babel/plugin-transform-template-literals@npm:^7.0.0-0, @babel/plugin-transform-template-literals@npm:^7.26.8":
14011401
version: 7.26.8
14021402
resolution: "@babel/plugin-transform-template-literals@npm:7.26.8"
14031403
dependencies:
@@ -1457,7 +1457,7 @@ __metadata:
14571457
languageName: node
14581458
linkType: hard
14591459

1460-
"@babel/plugin-transform-unicode-regex@npm:^7.0.0, @babel/plugin-transform-unicode-regex@npm:^7.25.9":
1460+
"@babel/plugin-transform-unicode-regex@npm:^7.0.0, @babel/plugin-transform-unicode-regex@npm:^7.0.0-0, @babel/plugin-transform-unicode-regex@npm:^7.25.9":
14611461
version: 7.25.9
14621462
resolution: "@babel/plugin-transform-unicode-regex@npm:7.25.9"
14631463
dependencies:
@@ -1602,7 +1602,7 @@ __metadata:
16021602
languageName: node
16031603
linkType: hard
16041604

1605-
"@babel/preset-typescript@npm:^7.13.0":
1605+
"@babel/preset-typescript@npm:^7.13.0, @babel/preset-typescript@npm:^7.16.7":
16061606
version: 7.27.0
16071607
resolution: "@babel/preset-typescript@npm:7.27.0"
16081608
dependencies:
@@ -5286,6 +5286,7 @@ __metadata:
52865286
eslint: "npm:^7.32.0"
52875287
react-native-device-info: "npm:13.0.0"
52885288
react-native-gesture-handler: "npm:2.24.0"
5289+
react-native-reanimated: "npm:3.16.1"
52895290
languageName: unknown
52905291
linkType: soft
52915292

@@ -7398,20 +7399,20 @@ __metadata:
73987399
languageName: node
73997400
linkType: hard
74007401

7402+
"escape-string-regexp@npm:2.0.0, escape-string-regexp@npm:^2.0.0":
7403+
version: 2.0.0
7404+
resolution: "escape-string-regexp@npm:2.0.0"
7405+
checksum: 10/9f8a2d5743677c16e85c810e3024d54f0c8dea6424fad3c79ef6666e81dd0846f7437f5e729dfcdac8981bc9e5294c39b4580814d114076b8d36318f46ae4395
7406+
languageName: node
7407+
linkType: hard
7408+
74017409
"escape-string-regexp@npm:^1.0.5":
74027410
version: 1.0.5
74037411
resolution: "escape-string-regexp@npm:1.0.5"
74047412
checksum: 10/6092fda75c63b110c706b6a9bfde8a612ad595b628f0bd2147eea1d3406723020810e591effc7db1da91d80a71a737a313567c5abb3813e8d9c71f4aa595b410
74057413
languageName: node
74067414
linkType: hard
74077415

7408-
"escape-string-regexp@npm:^2.0.0":
7409-
version: 2.0.0
7410-
resolution: "escape-string-regexp@npm:2.0.0"
7411-
checksum: 10/9f8a2d5743677c16e85c810e3024d54f0c8dea6424fad3c79ef6666e81dd0846f7437f5e729dfcdac8981bc9e5294c39b4580814d114076b8d36318f46ae4395
7412-
languageName: node
7413-
linkType: hard
7414-
74157416
"escape-string-regexp@npm:^4.0.0":
74167417
version: 4.0.0
74177418
resolution: "escape-string-regexp@npm:4.0.0"
@@ -14293,6 +14294,29 @@ __metadata:
1429314294
languageName: node
1429414295
linkType: hard
1429514296

14297+
"react-native-reanimated@npm:3.16.1":
14298+
version: 3.16.1
14299+
resolution: "react-native-reanimated@npm:3.16.1"
14300+
dependencies:
14301+
"@babel/plugin-transform-arrow-functions": "npm:^7.0.0-0"
14302+
"@babel/plugin-transform-class-properties": "npm:^7.0.0-0"
14303+
"@babel/plugin-transform-classes": "npm:^7.0.0-0"
14304+
"@babel/plugin-transform-nullish-coalescing-operator": "npm:^7.0.0-0"
14305+
"@babel/plugin-transform-optional-chaining": "npm:^7.0.0-0"
14306+
"@babel/plugin-transform-shorthand-properties": "npm:^7.0.0-0"
14307+
"@babel/plugin-transform-template-literals": "npm:^7.0.0-0"
14308+
"@babel/plugin-transform-unicode-regex": "npm:^7.0.0-0"
14309+
"@babel/preset-typescript": "npm:^7.16.7"
14310+
convert-source-map: "npm:^2.0.0"
14311+
invariant: "npm:^2.2.4"
14312+
peerDependencies:
14313+
"@babel/core": ^7.0.0-0
14314+
react: "*"
14315+
react-native: "*"
14316+
checksum: 10/3e46c32655a5e3d89dd79606179ebd6da96cedf31f15c64a32d4cea2c35ec5724411099aeaa59e5f8220c93fc268ee1b391b3210e7e87e43544e279edd2a2ccc
14317+
languageName: node
14318+
linkType: hard
14319+
1429614320
"react-native-schedule-exact-alarm-permission@npm:^0.1.3":
1429714321
version: 0.1.5
1429814322
resolution: "react-native-schedule-exact-alarm-permission@npm:0.1.5"
@@ -14418,16 +14442,16 @@ __metadata:
1441814442
languageName: node
1441914443
linkType: hard
1442014444

14421-
"react-native-webview@npm:13.13.2":
14422-
version: 13.13.2
14423-
resolution: "react-native-webview@npm:13.13.2"
14445+
"react-native-webview@npm:13.8.6":
14446+
version: 13.8.6
14447+
resolution: "react-native-webview@npm:13.8.6"
1442414448
dependencies:
14425-
escape-string-regexp: "npm:^4.0.0"
14449+
escape-string-regexp: "npm:2.0.0"
1442614450
invariant: "npm:2.2.4"
1442714451
peerDependencies:
1442814452
react: "*"
1442914453
react-native: "*"
14430-
checksum: 10/1e0e7b036910c751ad7ae95da37694a808ad92aff3645e7eee88f7969ed721b18e4c62a436129b1766135b2262d6568198eb83ef1e8cc1e68ca6cd708f6dc33f
14454+
checksum: 10/9a510ce0c36e733e565f16b3fd44be29f40aac9518db3550a0213206ad578c41ee7fc71431849f2f72e178098241a8f9f0cd31ebfdf2223fd39d349d2f8b9cd0
1443114455
languageName: node
1443214456
linkType: hard
1443314457

@@ -15656,7 +15680,7 @@ __metadata:
1565615680
"@mendix/pluggable-widgets-tools": "npm:~10.0.1"
1565715681
eslint: "npm:^7.32.0"
1565815682
react-native-signature-canvas: "npm:3.4.0"
15659-
react-native-webview: "npm:13.13.2"
15683+
react-native-webview: "npm:13.8.6"
1566015684
languageName: unknown
1566115685
linkType: soft
1566215686

@@ -17601,7 +17625,7 @@ __metadata:
1760117625
"@mendix/piw-utils-internal": "npm:*"
1760217626
"@mendix/pluggable-widgets-tools": "npm:~10.0.1"
1760317627
eslint: "npm:^7.32.0"
17604-
react-native-webview: "npm:13.13.2"
17628+
react-native-webview: "npm:13.8.6"
1760517629
languageName: unknown
1760617630
linkType: soft
1760717631

0 commit comments

Comments
 (0)