Skip to content

Commit 613baf4

Browse files
committed
fix: tests
1 parent f2f537c commit 613baf4

File tree

3 files changed

+42
-108
lines changed

3 files changed

+42
-108
lines changed

package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.js.snap

Lines changed: 15 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -800,16 +800,13 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
800800
style={
801801
[
802802
{
803-
"height": 0,
803+
"opacity": 0,
804804
},
805805
{
806806
"transform": [
807807
{
808808
"scale": 0,
809809
},
810-
{
811-
"translateY": 0,
812-
},
813810
],
814811
},
815812
]
@@ -832,18 +829,9 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
832829
<View
833830
pointerEvents="box-none"
834831
style={
835-
[
836-
{
837-
"height": 0,
838-
},
839-
{
840-
"transform": [
841-
{
842-
"translateY": 0,
843-
},
844-
],
845-
},
846-
]
832+
{
833+
"height": 0,
834+
}
847835
}
848836
testID="message-overlay-message"
849837
>
@@ -864,16 +852,13 @@ exports[`AttachButton should call handleAttachButtonPress when the button is cli
864852
style={
865853
[
866854
{
867-
"height": 0,
855+
"opacity": 0,
868856
},
869857
{
870858
"transform": [
871859
{
872860
"scale": 0,
873861
},
874-
{
875-
"translateY": 0,
876-
},
877862
],
878863
},
879864
]
@@ -1698,16 +1683,13 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
16981683
style={
16991684
[
17001685
{
1701-
"height": 0,
1686+
"opacity": 0,
17021687
},
17031688
{
17041689
"transform": [
17051690
{
17061691
"scale": 0,
17071692
},
1708-
{
1709-
"translateY": 0,
1710-
},
17111693
],
17121694
},
17131695
]
@@ -1730,18 +1712,9 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
17301712
<View
17311713
pointerEvents="box-none"
17321714
style={
1733-
[
1734-
{
1735-
"height": 0,
1736-
},
1737-
{
1738-
"transform": [
1739-
{
1740-
"translateY": 0,
1741-
},
1742-
],
1743-
},
1744-
]
1715+
{
1716+
"height": 0,
1717+
}
17451718
}
17461719
testID="message-overlay-message"
17471720
>
@@ -1762,16 +1735,13 @@ exports[`AttachButton should render a enabled AttachButton 1`] = `
17621735
style={
17631736
[
17641737
{
1765-
"height": 0,
1738+
"opacity": 0,
17661739
},
17671740
{
17681741
"transform": [
17691742
{
17701743
"scale": 0,
17711744
},
1772-
{
1773-
"translateY": 0,
1774-
},
17751745
],
17761746
},
17771747
]
@@ -2596,16 +2566,13 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
25962566
style={
25972567
[
25982568
{
2599-
"height": 0,
2569+
"opacity": 0,
26002570
},
26012571
{
26022572
"transform": [
26032573
{
26042574
"scale": 0,
26052575
},
2606-
{
2607-
"translateY": 0,
2608-
},
26092576
],
26102577
},
26112578
]
@@ -2628,18 +2595,9 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
26282595
<View
26292596
pointerEvents="box-none"
26302597
style={
2631-
[
2632-
{
2633-
"height": 0,
2634-
},
2635-
{
2636-
"transform": [
2637-
{
2638-
"translateY": 0,
2639-
},
2640-
],
2641-
},
2642-
]
2598+
{
2599+
"height": 0,
2600+
}
26432601
}
26442602
testID="message-overlay-message"
26452603
>
@@ -2660,16 +2618,13 @@ exports[`AttachButton should render an disabled AttachButton 1`] = `
26602618
style={
26612619
[
26622620
{
2663-
"height": 0,
2621+
"opacity": 0,
26642622
},
26652623
{
26662624
"transform": [
26672625
{
26682626
"scale": 0,
26692627
},
2670-
{
2671-
"translateY": 0,
2672-
},
26732628
],
26742629
},
26752630
]

package/src/components/MessageInput/__tests__/__snapshots__/SendButton.test.js.snap

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -789,16 +789,13 @@ exports[`SendButton should render a SendButton 1`] = `
789789
style={
790790
[
791791
{
792-
"height": 0,
792+
"opacity": 0,
793793
},
794794
{
795795
"transform": [
796796
{
797797
"scale": 0,
798798
},
799-
{
800-
"translateY": 0,
801-
},
802799
],
803800
},
804801
]
@@ -821,18 +818,9 @@ exports[`SendButton should render a SendButton 1`] = `
821818
<View
822819
pointerEvents="box-none"
823820
style={
824-
[
825-
{
826-
"height": 0,
827-
},
828-
{
829-
"transform": [
830-
{
831-
"translateY": 0,
832-
},
833-
],
834-
},
835-
]
821+
{
822+
"height": 0,
823+
}
836824
}
837825
testID="message-overlay-message"
838826
>
@@ -853,16 +841,13 @@ exports[`SendButton should render a SendButton 1`] = `
853841
style={
854842
[
855843
{
856-
"height": 0,
844+
"opacity": 0,
857845
},
858846
{
859847
"transform": [
860848
{
861849
"scale": 0,
862850
},
863-
{
864-
"translateY": 0,
865-
},
866851
],
867852
},
868853
]
@@ -1676,16 +1661,13 @@ exports[`SendButton should render a disabled SendButton 1`] = `
16761661
style={
16771662
[
16781663
{
1679-
"height": 0,
1664+
"opacity": 0,
16801665
},
16811666
{
16821667
"transform": [
16831668
{
16841669
"scale": 0,
16851670
},
1686-
{
1687-
"translateY": 0,
1688-
},
16891671
],
16901672
},
16911673
]
@@ -1708,18 +1690,9 @@ exports[`SendButton should render a disabled SendButton 1`] = `
17081690
<View
17091691
pointerEvents="box-none"
17101692
style={
1711-
[
1712-
{
1713-
"height": 0,
1714-
},
1715-
{
1716-
"transform": [
1717-
{
1718-
"translateY": 0,
1719-
},
1720-
],
1721-
},
1722-
]
1693+
{
1694+
"height": 0,
1695+
}
17231696
}
17241697
testID="message-overlay-message"
17251698
>
@@ -1740,16 +1713,13 @@ exports[`SendButton should render a disabled SendButton 1`] = `
17401713
style={
17411714
[
17421715
{
1743-
"height": 0,
1716+
"opacity": 0,
17441717
},
17451718
{
17461719
"transform": [
17471720
{
17481721
"scale": 0,
17491722
},
1750-
{
1751-
"translateY": 0,
1752-
},
17531723
],
17541724
},
17551725
]

package/src/contexts/overlayContext/__tests__/MessageOverlayHostLayer.test.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ jest.mock('react-native-reanimated', () => {
7575
},
7676
clamp: (value: number, min: number, max: number) => Math.min(Math.max(value, min), max),
7777
runOnJS: (fn: (...args: unknown[]) => unknown) => fn,
78+
useAnimatedReaction: (
79+
prepare: () => unknown,
80+
react: (current: unknown, previous: unknown) => void,
81+
) => {
82+
react(prepare(), undefined);
83+
},
7884
useAnimatedStyle: (updater: () => unknown) => updater(),
7985
useDerivedValue: (updater: () => unknown) => ({ value: updater() }),
8086
useSharedValue: useStableSharedValue,
@@ -175,25 +181,26 @@ describe('MessageOverlayHostLayer', () => {
175181
expect(StyleSheet.flatten(topSlot.props.style)).toMatchObject({
176182
height: TOP_RECT.h,
177183
left: TOP_RECT.x,
184+
opacity: 1,
178185
position: 'absolute',
179-
top: TOP_RECT.y,
180-
transform: [{ scale: 1 }, { translateY: 38 }],
186+
top: 38,
187+
transform: [{ scale: 1 }],
181188
width: TOP_RECT.w,
182189
});
183190
expect(StyleSheet.flatten(messageSlot.props.style)).toMatchObject({
184191
height: MESSAGE_RECT.h,
185192
left: MESSAGE_RECT.x,
186193
position: 'absolute',
187-
top: MESSAGE_RECT.y,
188-
transform: [{ translateY: 38 }],
194+
top: 38,
189195
width: MESSAGE_RECT.w,
190196
});
191197
expect(StyleSheet.flatten(bottomSlot.props.style)).toMatchObject({
192198
height: BOTTOM_RECT.h,
193199
left: BOTTOM_RECT.x,
200+
opacity: 1,
194201
position: 'absolute',
195-
top: BOTTOM_RECT.y,
196-
transform: [{ scale: 1 }, { translateY: -12 }],
202+
top: 88,
203+
transform: [{ scale: 1 }],
197204
width: BOTTOM_RECT.w,
198205
});
199206
});
@@ -227,7 +234,8 @@ describe('MessageOverlayHostLayer', () => {
227234

228235
expect(StyleSheet.flatten(screen.getByTestId('message-overlay-top').props.style)).toMatchObject(
229236
{
230-
height: 0,
237+
opacity: 0,
238+
transform: [{ scale: 0 }],
231239
},
232240
);
233241
expect(
@@ -236,7 +244,8 @@ describe('MessageOverlayHostLayer', () => {
236244
expect(
237245
StyleSheet.flatten(screen.getByTestId('message-overlay-bottom').props.style),
238246
).toMatchObject({
239-
height: 0,
247+
opacity: 0,
248+
transform: [{ scale: 0 }],
240249
});
241250
});
242251
});

0 commit comments

Comments
 (0)