fix: allow guest recommend swipe
This commit is contained in:
@@ -3246,6 +3246,41 @@ test('logged out active recommend bottom tab selects next work without login', a
|
||||
expect(openLoginModal).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('logged out recommend card supports vertical swipe without login', () => {
|
||||
vi.useFakeTimers();
|
||||
const onSelectNextRecommendEntry = vi.fn();
|
||||
const openLoginModal = vi.fn();
|
||||
|
||||
renderLoggedOutHomeView(openLoginModal, {
|
||||
latestEntries: [
|
||||
puzzlePublicEntry,
|
||||
{
|
||||
...puzzlePublicEntry,
|
||||
workId: 'puzzle-work-guest-next',
|
||||
profileId: 'puzzle-profile-guest-next',
|
||||
ownerUserId: 'user-guest-next',
|
||||
publicWorkCode: 'PZ-GUEST-NEXT',
|
||||
worldName: '访客下一张',
|
||||
},
|
||||
],
|
||||
activeRecommendEntryKey: 'puzzle:user-2:puzzle-profile-public-1',
|
||||
onSelectNextRecommendEntry,
|
||||
recommendRuntimeContent: <div data-testid="guest-recommend-runtime" />,
|
||||
});
|
||||
|
||||
const meta = screen.getByLabelText('奇幻拼图 作品信息') as HTMLElement;
|
||||
act(() => {
|
||||
dispatchPointerEvent(meta, 'pointerdown', { pointerId: 1, clientY: 320 });
|
||||
dispatchPointerEvent(meta, 'pointermove', { pointerId: 1, clientY: 220 });
|
||||
dispatchPointerEvent(meta, 'pointerup', { pointerId: 1, clientY: 220 });
|
||||
vi.advanceTimersByTime(180);
|
||||
});
|
||||
|
||||
expect(onSelectNextRecommendEntry).toHaveBeenCalledTimes(1);
|
||||
expect(openLoginModal).not.toHaveBeenCalled();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
test('mobile recommend meta loads real author avatar from public user summary', async () => {
|
||||
mockGetPublicAuthUserById.mockResolvedValueOnce({
|
||||
id: 'user-2',
|
||||
|
||||
@@ -5282,7 +5282,6 @@ export function RpgEntryHomeView({
|
||||
(event: PointerEvent<HTMLElement>) => {
|
||||
if (
|
||||
recommendDragCommitDirection ||
|
||||
!isAuthenticated ||
|
||||
!activeRecommendEntry ||
|
||||
recommendedFeedEntries.length <= 1
|
||||
) {
|
||||
@@ -5298,7 +5297,6 @@ export function RpgEntryHomeView({
|
||||
},
|
||||
[
|
||||
activeRecommendEntry,
|
||||
isAuthenticated,
|
||||
recommendDragCommitDirection,
|
||||
recommendedFeedEntries.length,
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user