fix(dashboard): stop MissionManager rendering mobile+desktop title together
The header rendered both a "Missions" desktop span AND a mobile span containing the selected mission title simultaneously, relying on CSS to hide the inactive variant. jsdom doesn't apply media queries, so testing-library's getByText found the mission title in both the body cards and the otherwise-hidden mobile header — failing 49 tests with "Found multiple elements with the text: <title>". Render only the active variant based on isMobile. Also clear localStorage in beforeEach so the SWR mission cache from prior tests doesn't pre-hydrate into the next render and surface its own fixtures as duplicates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4205,10 +4205,13 @@ export function MissionManager({ isOpen, isInline = false, onClose, addToast, pr
|
||||
)}
|
||||
<Target size={18} className="mission-manager__header-icon" />
|
||||
<h2 className="mission-manager__title" data-testid="mission-header-title">
|
||||
<span className="mission-manager__title-text mission-manager__title-text--desktop">Missions</span>
|
||||
<span className="mission-manager__title-text mission-manager__title-text--mobile">
|
||||
{selectedMission ? selectedMission.title : "Missions"}
|
||||
</span>
|
||||
{isMobile ? (
|
||||
<span className="mission-manager__title-text mission-manager__title-text--mobile">
|
||||
{selectedMission ? selectedMission.title : "Missions"}
|
||||
</span>
|
||||
) : (
|
||||
<span className="mission-manager__title-text mission-manager__title-text--desktop">Missions</span>
|
||||
)}
|
||||
</h2>
|
||||
</div>
|
||||
{!isInline && (
|
||||
|
||||
@@ -740,6 +740,9 @@ describe("MissionManager", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
mockViewport("desktop");
|
||||
// Reset SWR cache so prior tests' mission lists don't pre-hydrate into the
|
||||
// current render and surface duplicates of fixture titles.
|
||||
localStorage.clear();
|
||||
originalFetch = globalThis.fetch;
|
||||
originalEventSource = globalThis.EventSource;
|
||||
mockFetchAiSession.mockReset();
|
||||
|
||||
Reference in New Issue
Block a user