fix(notices): pass the Patreon handler in the modal test, logical sides in the card drawings, no non-null assertions

This commit is contained in:
Maurice
2026-11-23 21:25:39 +01:00
parent 34e28d082d
commit aab09afc53
3 changed files with 22 additions and 20 deletions
@@ -59,15 +59,17 @@ function renderModal(
onDismiss: () => void;
onCTA: () => void;
onSecondaryCTA: () => void;
onTertiaryCTA: () => void;
}> = {}
) {
const onDismiss = handlers.onDismiss ?? vi.fn();
const onCTA = handlers.onCTA ?? vi.fn();
const onSecondaryCTA = handlers.onSecondaryCTA ?? vi.fn();
const onTertiaryCTA = handlers.onTertiaryCTA ?? vi.fn();
const view = render(
<ReleaseNoticeModal notice={notice} visible onDismiss={onDismiss} onCTA={onCTA} onSecondaryCTA={onSecondaryCTA} />
<ReleaseNoticeModal notice={notice} visible onDismiss={onDismiss} onCTA={onCTA} onSecondaryCTA={onSecondaryCTA} onTertiaryCTA={onTertiaryCTA} />
);
return { ...view, onDismiss, onCTA, onSecondaryCTA };
return { ...view, onDismiss, onCTA, onSecondaryCTA, onTertiaryCTA };
}
describe('ReleaseNoticeModal', () => {
@@ -567,7 +567,7 @@ function useSystemNoticeModal(notices: SystemNoticeDTO[]) {
// Both buttons only render when the notice carries the matching cta.
function handleCTA() { runCta(notice!.cta!); }
function handleSecondaryCTA() { runCta(notice!.secondaryCta!); }
function handleTertiaryCTA() { runCta(notice!.tertiaryCta!); }
function handleTertiaryCTA() { if (notice?.tertiaryCta) runCta(notice.tertiaryCta); }
function animatedDismissAll() {
const sheet = sheetRef.current;
@@ -191,13 +191,12 @@
color: oklch(1 0 0 / 0.75);
}
/* rtl-lint-disable-next-line: the map runs west to east in every language */
.rn-vis-flight-from {
left: 12px; /* rtl-lint-disable */
inset-inline-start: 12px;
}
.rn-vis-flight-to {
right: 12px; /* rtl-lint-disable */
inset-inline-end: 12px;
}
.rn-vis-flight-live {
@@ -241,7 +240,8 @@
.rn-vis-pdf-page {
position: absolute;
top: 14px;
left: 50%; /* rtl-lint-disable */
inset-inline: 0;
margin-inline: auto;
display: flex;
flex-direction: column;
gap: 5px;
@@ -271,7 +271,7 @@
.rn-vis-pdf-cover {
padding: 0;
overflow: hidden;
transform: translateX(-50%);
transform: none;
animation: rn-cover 0.45s ease 0.15s both;
}
@@ -313,33 +313,33 @@
@keyframes rn-cover {
from {
opacity: 0;
transform: translateX(-50%) translateY(6px);
transform: translateY(6px);
}
to {
opacity: 1;
transform: translateX(-50%);
transform: none;
}
}
@keyframes rn-fan-back {
from {
opacity: 0;
transform: translateX(-50%) rotate(0);
transform: rotate(0);
}
to {
opacity: 1;
transform: translateX(-104%) rotate(-12deg);
transform: translateX(-54%) rotate(-12deg);
}
}
@keyframes rn-fan-mid {
from {
opacity: 0;
transform: translateX(-50%) rotate(0);
transform: rotate(0);
}
to {
opacity: 1;
transform: translateX(4%) rotate(11deg);
transform: translateX(54%) rotate(11deg);
}
}
@@ -635,13 +635,13 @@
stroke-dashoffset: 0;
}
.rn-vis-pdf-back {
transform: translateX(-104%) rotate(-12deg);
transform: translateX(-54%) rotate(-12deg);
}
.rn-vis-pdf-mid {
transform: translateX(4%) rotate(11deg);
transform: translateX(54%) rotate(11deg);
}
.rn-vis-pdf-cover {
transform: translateX(-50%);
transform: none;
}
}
@@ -683,13 +683,13 @@
}
[data-reduce-motion='true'] .rn-vis-pdf-back {
transform: translateX(-104%) rotate(-12deg);
transform: translateX(-54%) rotate(-12deg);
}
[data-reduce-motion='true'] .rn-vis-pdf-mid {
transform: translateX(4%) rotate(11deg);
transform: translateX(54%) rotate(11deg);
}
[data-reduce-motion='true'] .rn-vis-pdf-cover {
transform: translateX(-50%);
transform: none;
}