Skip to content

Commit 83235be

Browse files
committed
Merge branch 'master' into account-integration
2 parents ff24d5a + a1efc6d commit 83235be

31 files changed

Lines changed: 599 additions & 1289 deletions

frontend/__tests__/components/common/AsyncContent.spec.tsx

Lines changed: 17 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ describe("AsyncContent", () => {
142142
query: {
143143
result: string | Error;
144144
},
145-
options?: Omit<Props<unknown>, "query" | "queries" | "children">,
145+
options?: Omit<Props<{ result: string }>, "queries" | "children">,
146146
): {
147147
container: HTMLElement;
148148
} {
@@ -159,39 +159,19 @@ describe("AsyncContent", () => {
159159
retry: 0,
160160
}));
161161

162-
if (options?.alwaysShowContent) {
163-
return (
164-
<AsyncContent
165-
query={myQuery}
166-
{...(options as Props<string>)}
167-
alwaysShowContent
168-
>
169-
{(data) => (
170-
<>
171-
static content
172-
<Show
173-
when={data() !== undefined}
174-
fallback={<div>no data</div>}
175-
>
176-
<div data-testid="content">{data()}</div>
177-
</Show>
178-
</>
179-
)}
180-
</AsyncContent>
181-
);
182-
}
183-
184162
return (
185163
<AsyncContent
186-
query={myQuery}
187-
{...(options as Props<string>)}
188-
alwaysShowContent={false}
164+
queries={{ result: myQuery }}
165+
{...(options as Props<{ result: string | undefined }>)}
189166
>
190-
{(data) => (
167+
{({ resultData }) => (
191168
<>
192169
static content
193-
<Show when={data() !== undefined} fallback={<div>no data</div>}>
194-
<div data-testid="content">{data()}</div>
170+
<Show
171+
when={resultData() !== undefined}
172+
fallback={<div>no data</div>}
173+
>
174+
<div data-testid="content">{resultData()}</div>
195175
</Show>
196176
</>
197177
)}
@@ -344,7 +324,10 @@ describe("AsyncContent", () => {
344324
first: string | Error | undefined;
345325
second: string | Error | undefined;
346326
},
347-
options?: Omit<Props<unknown>, "query" | "queries" | "children">,
327+
options?: Omit<
328+
Props<{ first: string; second: string }>,
329+
"queries" | "children"
330+
>,
348331
): {
349332
container: HTMLElement;
350333
} {
@@ -374,48 +357,20 @@ describe("AsyncContent", () => {
374357

375358
type Q = { first: string | undefined; second: string | undefined };
376359

377-
if (options?.alwaysShowContent) {
378-
return (
379-
<AsyncContent
380-
queries={{ first: firstQuery, second: secondQuery }}
381-
{...(options as Props<Q>)}
382-
alwaysShowContent
383-
>
384-
{(results) => (
385-
<>
386-
<Show
387-
when={
388-
results()?.first !== undefined &&
389-
results()?.second !== undefined
390-
}
391-
fallback={<div>no data</div>}
392-
>
393-
<div data-testid="first">{results()?.first}</div>
394-
<div data-testid="second">{results()?.second}</div>
395-
</Show>
396-
</>
397-
)}
398-
</AsyncContent>
399-
);
400-
}
401-
402360
return (
403361
<AsyncContent
404362
queries={{ first: firstQuery, second: secondQuery }}
405363
{...(options as Props<Q>)}
406364
alwaysShowContent={false}
407365
>
408-
{(results) => (
366+
{({ firstData, secondData }) => (
409367
<>
410368
<Show
411-
when={
412-
results().first !== undefined &&
413-
results().second !== undefined
414-
}
369+
when={firstData() !== undefined && secondData() !== undefined}
415370
fallback={<div>no data</div>}
416371
>
417-
<div data-testid="first">{results().first}</div>
418-
<div data-testid="second">{results().second}</div>
372+
<div data-testid="first">{firstData()}</div>
373+
<div data-testid="second">{secondData()}</div>
419374
</Show>
420375
</>
421376
)}

frontend/__tests__/components/common/Conditional.spec.tsx

Lines changed: 0 additions & 214 deletions
This file was deleted.

0 commit comments

Comments
 (0)