From 56e60ce589e2dac66975f86f4bdd640b1b70e7d2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 2 Aug 2026 23:04:32 +0000 Subject: [PATCH] =?UTF-8?q?B146=20=E2=80=94=20stub=20innerWidth=20in=20mob?= =?UTF-8?q?ile=20overlay=20unit=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Francisco Solla --- tests/unit/campaignQuickActionsDrawer.unit.spec.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx b/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx index 6d36a643..773528d6 100644 --- a/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx +++ b/tests/unit/campaignQuickActionsDrawer.unit.spec.tsx @@ -54,6 +54,12 @@ const searchWithPriorityPayload: HomeSearchSuccessResponse = { const matchMediaMock = vi.fn() +let innerWidthSpy: ReturnType | undefined + +const stubMobileViewport = () => { + innerWidthSpy = vi.spyOn(window, 'innerWidth', 'get').mockReturnValue(375) +} + beforeEach(() => { matchMediaMock.mockImplementation((query: string) => ({ matches: false, @@ -69,6 +75,8 @@ beforeEach(() => { afterEach(() => { cleanup() + innerWidthSpy?.mockRestore() + innerWidthSpy = undefined vi.mocked(postCampaignJson).mockReset() vi.unstubAllGlobals() }) @@ -358,6 +366,7 @@ describe('CampaignQuickActionsOverlay (B126)', () => { }) it('shows swipe handle and no dialog close on mobile (B146)', () => { + stubMobileViewport() matchMediaMock.mockImplementation((query: string) => ({ matches: query.includes('max-width'), media: query, @@ -393,6 +402,7 @@ describe('CampaignQuickActionsOverlay (B126)', () => { }) it('uses mobile drawer with actions above search', () => { + stubMobileViewport() matchMediaMock.mockImplementation((query: string) => ({ matches: query.includes('max-width'), media: query,