mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-26 06:37:33 +00:00
fix(native): placeholders pass the tests and the theme, the swipe actions use tokens, the task card stays simple
This commit is contained in:
@@ -769,7 +769,7 @@ input[type="number"], input[type="time"], input[type="date"], input[type="dateti
|
||||
--fs-scale-caption: 1;
|
||||
|
||||
--success: #16a34a; --success-soft: #dcfce7;
|
||||
--danger: #dc2626; --danger-soft: #fef2f2;
|
||||
--danger: #dc2626; --danger-soft: #fef2f2; --danger-text: #ffffff;
|
||||
--warning: #d97706; --warning-soft: #fffbeb;
|
||||
--info: #2563eb; --info-soft: #eff6ff;
|
||||
|
||||
@@ -866,7 +866,7 @@ input[type="number"], input[type="time"], input[type="date"], input[type="dateti
|
||||
--day-tint-l-max: 0.88;
|
||||
|
||||
--success: #22c55e; --success-soft: rgba(34, 197, 94, 0.15);
|
||||
--danger: #ef4444; --danger-soft: rgba(239, 68, 68, 0.15);
|
||||
--danger: #ef4444; --danger-soft: rgba(239, 68, 68, 0.15); --danger-text: #ffffff;
|
||||
--warning: #f59e0b; --warning-soft: rgba(245, 158, 11, 0.15);
|
||||
--info: #3b82f6; --info-soft: rgba(59, 130, 246, 0.15);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import MSheet from './MSheet';
|
||||
* card's own buttons offer, so this is a second way, never the only one.
|
||||
*/
|
||||
|
||||
export interface ContextAction {
|
||||
interface ContextAction {
|
||||
key: string;
|
||||
label: string;
|
||||
icon: ReactElement;
|
||||
@@ -38,7 +38,7 @@ export default function MContextMenu({ open, title, actions, onClose }: MContext
|
||||
onClose();
|
||||
action.onClick();
|
||||
}}
|
||||
className={`flex w-full items-center gap-[11px] rounded-xl px-[10px] py-[11px] text-start text-[0.84375rem] font-semibold active:bg-[color:var(--m-ic)] ${
|
||||
className={`flex w-full items-center gap-[11px] rounded-xl px-[10px] py-[11px] text-start text-body font-semibold active:bg-[color:var(--m-ic)] ${
|
||||
danger ? 'text-[color:var(--m-st-danger)]' : 'text-m-ink'
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useTranslation } from '../../i18n';
|
||||
* once as "Loading" for a screen reader; the shapes themselves are hidden from it.
|
||||
*/
|
||||
|
||||
export type MSkeletonVariant = 'rows' | 'cards' | 'detail' | 'map';
|
||||
type MSkeletonVariant = 'rows' | 'cards' | 'detail' | 'map';
|
||||
|
||||
interface MSkeletonProps {
|
||||
variant: MSkeletonVariant;
|
||||
@@ -69,6 +69,7 @@ export default function MSkeleton({ variant, count = 4, framed = true, className
|
||||
return (
|
||||
<div
|
||||
role="status"
|
||||
data-skeleton=""
|
||||
aria-label={t('common.loading')}
|
||||
className={`animate-pulse motion-reduce:animate-none ${className}`}
|
||||
>
|
||||
|
||||
@@ -45,9 +45,9 @@ const AXIS_BIAS = 1.5;
|
||||
const FULL_SHARE = 0.62;
|
||||
|
||||
const TONE: Record<SwipeAction['tone'], string> = {
|
||||
danger: 'bg-danger text-white', // theme-lint-disable: white on the danger fill, as the delete buttons draw it
|
||||
danger: 'bg-danger text-[color:var(--danger-text)]',
|
||||
accent: 'bg-m-act text-m-actfg',
|
||||
neutral: 'bg-[color:var(--m-faint)] text-white', // theme-lint-disable: white on the neutral action fill
|
||||
neutral: 'bg-[color:var(--bg-inverse)] text-[color:var(--text-inverse)]',
|
||||
};
|
||||
|
||||
// The row open now, so opening another closes it.
|
||||
@@ -201,7 +201,7 @@ export default function MSwipeRow({
|
||||
data-swipe-action=""
|
||||
tabIndex={open ? 0 : -1}
|
||||
onClick={() => run(action)}
|
||||
className={`flex h-full w-[76px] flex-none flex-col items-center justify-center gap-1 text-[0.6875rem] font-semibold ${TONE[action.tone]}`}
|
||||
className={`flex h-full w-[76px] flex-none flex-col items-center justify-center gap-1 text-caption font-semibold ${TONE[action.tone]}`}
|
||||
>
|
||||
<action.icon size={18} strokeWidth={2.2} aria-hidden="true" />
|
||||
{action.label}
|
||||
|
||||
@@ -37,9 +37,13 @@ describe('useLongPress', () => {
|
||||
it('FE-MOB-LONGPRESS-001: a held finger lifts the card, bumps and opens the menu, and the tap that ends it opens nothing', () => {
|
||||
const { card, onLongPress, onClick } = setup();
|
||||
touch(card, 'touchstart');
|
||||
act(() => vi.advanceTimersByTime(200));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(200);
|
||||
});
|
||||
expect(card.hasAttribute('data-pressing')).toBe(true);
|
||||
act(() => vi.advanceTimersByTime(300));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(300);
|
||||
});
|
||||
expect(onLongPress).toHaveBeenCalledOnce();
|
||||
expect(pressHaptic).toHaveBeenCalled();
|
||||
expect(card.hasAttribute('data-pressing')).toBe(false);
|
||||
@@ -52,14 +56,18 @@ describe('useLongPress', () => {
|
||||
const { card, onLongPress } = setup();
|
||||
touch(card, 'touchstart');
|
||||
touch(card, 'touchmove', 50, 80);
|
||||
act(() => vi.advanceTimersByTime(600));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(600);
|
||||
});
|
||||
expect(onLongPress).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-MOB-LONGPRESS-003: a short tap is a tap', () => {
|
||||
const { card, onLongPress, onClick } = setup();
|
||||
touch(card, 'touchstart');
|
||||
act(() => vi.advanceTimersByTime(100));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(100);
|
||||
});
|
||||
touch(card, 'touchend');
|
||||
fireEvent.click(card);
|
||||
expect(onLongPress).not.toHaveBeenCalled();
|
||||
|
||||
@@ -214,6 +214,24 @@ export default function MTodoListTab({ planner }: { planner: TripPlanner }) {
|
||||
)
|
||||
}
|
||||
|
||||
/** A swipe does what the card offers: tick it off, open it, or delete it. */
|
||||
function taskSwipeActions(
|
||||
item: TodoItem,
|
||||
t: (key: string) => string,
|
||||
onToggle: (id: number, checked: boolean) => void,
|
||||
onOpen: (id: number) => void,
|
||||
onDelete?: (id: number) => void,
|
||||
): { leading: SwipeAction; trailing: SwipeAction[] } {
|
||||
const leading: SwipeAction = item.checked
|
||||
? { label: t('todo.filter.open'), icon: RotateCcw, tone: 'neutral', onAction: () => onToggle(item.id, false) }
|
||||
: { label: t('todo.filter.done'), icon: Check, tone: 'accent', onAction: () => onToggle(item.id, true) }
|
||||
const trailing: SwipeAction[] = [
|
||||
...(onDelete ? [{ label: t('common.delete'), icon: Trash2, tone: 'danger' as const, onAction: () => onDelete(item.id) }] : []),
|
||||
{ label: t('common.edit'), icon: Pencil, tone: 'neutral', onAction: () => onOpen(item.id) },
|
||||
]
|
||||
return { leading, trailing }
|
||||
}
|
||||
|
||||
function TaskCard({ item, members, today, onToggle, onOpen, onDelete }: {
|
||||
item: TodoItem
|
||||
members: TripMember[]
|
||||
@@ -235,14 +253,7 @@ function TaskCard({ item, members, today, onToggle, onOpen, onDelete }: {
|
||||
? (Number.isNaN(Date.parse(`${item.due_date}T00:00:00Z`)) ? item.due_date : formatDate(item.due_date, locale))
|
||||
: null
|
||||
|
||||
// A swipe does what the card offers: tick it off, open it, or delete it.
|
||||
const leading: SwipeAction = done
|
||||
? { label: t('todo.filter.open'), icon: RotateCcw, tone: 'neutral', onAction: () => onToggle(item.id, false) }
|
||||
: { label: t('todo.filter.done'), icon: Check, tone: 'accent', onAction: () => onToggle(item.id, true) }
|
||||
const trailing: SwipeAction[] = [
|
||||
...(onDelete ? [{ label: t('common.delete'), icon: Trash2, tone: 'danger' as const, onAction: () => onDelete(item.id) }] : []),
|
||||
{ label: t('common.edit'), icon: Pencil, tone: 'neutral', onAction: () => onOpen(item.id) },
|
||||
]
|
||||
const { leading, trailing } = taskSwipeActions(item, t, onToggle, onOpen, onDelete)
|
||||
|
||||
return (
|
||||
<MSwipeRow leading={leading} trailing={trailing} surface="rounded-2xl bg-[color:var(--m-bg)]" className="mt-2 rounded-2xl">
|
||||
|
||||
@@ -27,7 +27,7 @@ free **if they follow the contract below**.
|
||||
| Text | `--text-primary/secondary/muted/faint` · `text-content*` |
|
||||
| Borders | `--border-primary/secondary/faint` · `border-edge*` |
|
||||
| Accent | `--accent` (fill) · `--accent-text` (on fill) · `--accent-on` (on surface) · `--accent-hover` · `--accent-subtle` · `bg-accent` / `text-accent-on` / `bg-accent-subtle` |
|
||||
| Status | `--success/-soft`, `--danger/-soft`, `--warning/-soft`, `--info/-soft` · `bg-danger-soft text-danger` etc. |
|
||||
| Status | `--success/-soft`, `--danger/-soft`, `--warning/-soft`, `--info/-soft` · `bg-danger-soft text-danger` etc.; `--danger-text` for text on a solid `bg-danger` |
|
||||
| Elevation | `--shadow-sm/md/lg/card/elevated/modal/dropdown/popover` · `shadow-modal` etc. |
|
||||
| Overlay / inverse | `--overlay` · `--bg-inverse` / `--text-inverse` · `bg-inverse text-inverse-text` |
|
||||
| Type tiers | `text-title` / `text-subtitle` / `text-body` / `text-caption` (scale with the user's per-tier multipliers) |
|
||||
|
||||
@@ -63,7 +63,7 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe('MAdminAddonManager', () => {
|
||||
it('FE-MOB-AADD-001: shows the spinner while addons load', async () => {
|
||||
it('FE-MOB-AADD-001: shows the placeholders while addons load', async () => {
|
||||
server.use(
|
||||
http.get('/api/admin/addons', async () => {
|
||||
await delay(60);
|
||||
@@ -72,9 +72,9 @@ describe('MAdminAddonManager', () => {
|
||||
);
|
||||
render(<MAdminAddonManager />);
|
||||
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
await screen.findByText('No addons available');
|
||||
expect(document.querySelector('.animate-spin')).not.toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-AADD-002: the header uses the light wordmark in light mode', async () => {
|
||||
|
||||
@@ -29,12 +29,12 @@ describe('MAdminCategoryManager', () => {
|
||||
server.use(http.get('/api/categories', () => HttpResponse.json({ categories: [] })));
|
||||
});
|
||||
|
||||
it('FE-MOB-MCAT-001: shows a spinner while the list is loading, then the empty state', async () => {
|
||||
it('FE-MOB-MCAT-001: shows placeholders while the list is loading, then the empty state', async () => {
|
||||
render(<MAdminCategoryManager />);
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
|
||||
expect(await screen.findByText('No categories yet')).toBeInTheDocument();
|
||||
expect(document.querySelector('.animate-spin')).not.toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-MCAT-002: renders the card head and the New Category action', async () => {
|
||||
|
||||
@@ -50,7 +50,7 @@ afterEach(() => {
|
||||
|
||||
async function renderPanel(props: { isPrerelease?: boolean } = {}) {
|
||||
const view = render(<MAdminGitHubPanel {...props} />);
|
||||
await waitFor(() => expect(document.querySelector('.animate-spin')).not.toBeInTheDocument());
|
||||
await waitFor(() => expect(document.querySelector('[data-skeleton]')).not.toBeInTheDocument());
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('MAdminGitHubPanel', () => {
|
||||
expect(screen.getAllByText('Helps me keep building TREK')).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('FE-MOB-AGH-002: shows a spinner while the releases request is in flight', () => {
|
||||
it('FE-MOB-AGH-002: shows placeholders while the releases request is in flight', () => {
|
||||
server.use(
|
||||
http.get('/api/admin/github-releases', async () => {
|
||||
await new Promise(() => {});
|
||||
@@ -82,7 +82,7 @@ describe('MAdminGitHubPanel', () => {
|
||||
);
|
||||
render(<MAdminGitHubPanel />);
|
||||
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Release History')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ describe('MAdminMcpTokensPanel', () => {
|
||||
await screen.findByText('No MCP tokens have been created yet');
|
||||
});
|
||||
|
||||
it('FE-MOB-MCPTOK-002: shows spinners while both requests are in flight', async () => {
|
||||
it('FE-MOB-MCPTOK-002: shows placeholders while both requests are in flight', async () => {
|
||||
server.use(
|
||||
http.get('/api/admin/mcp-tokens', async () => {
|
||||
await new Promise(() => {});
|
||||
@@ -93,7 +93,7 @@ describe('MAdminMcpTokensPanel', () => {
|
||||
);
|
||||
renderPanel();
|
||||
|
||||
expect(document.querySelectorAll('.animate-spin')).toHaveLength(2);
|
||||
expect(document.querySelectorAll('[data-skeleton]')).toHaveLength(2);
|
||||
expect(screen.queryByText('No MCP tokens have been created yet')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe('MAdminPackingTemplateManager', () => {
|
||||
it('FE-MOB-APKG-001: shows the spinner while templates load, then the empty state', async () => {
|
||||
it('FE-MOB-APKG-001: shows the placeholders while templates load, then the empty state', async () => {
|
||||
server.use(
|
||||
http.get('/api/admin/packing-templates', async () => {
|
||||
await new Promise(r => setTimeout(r, 60));
|
||||
@@ -60,12 +60,12 @@ describe('MAdminPackingTemplateManager', () => {
|
||||
);
|
||||
renderManager();
|
||||
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
expect(screen.getByText('Packing Templates')).toBeInTheDocument();
|
||||
expect(screen.getByText('Create reusable packing lists for your trips')).toBeInTheDocument();
|
||||
|
||||
await screen.findByText('No templates created yet');
|
||||
expect(document.querySelector('.animate-spin')).not.toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-APKG-002: renders each template with its category and item counts', async () => {
|
||||
|
||||
@@ -47,7 +47,7 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
describe('MAdminPermissionsPanel', () => {
|
||||
it('FE-MOB-APERM-001: renders only the spinner while loading', () => {
|
||||
it('FE-MOB-APERM-001: renders only the placeholders while loading', () => {
|
||||
server.use(
|
||||
http.get('/api/admin/permissions', async () => {
|
||||
await new Promise(() => {});
|
||||
@@ -56,7 +56,7 @@ describe('MAdminPermissionsPanel', () => {
|
||||
);
|
||||
renderPanel();
|
||||
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Permission Settings')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ describe('MAdminUsersSection', () => {
|
||||
expect(screen.getByRole('presentation')).toHaveAttribute('src', '/uploads/bob.png');
|
||||
});
|
||||
|
||||
it('FE-MOB-AUSERS-003: the spinner replaces the list while users are loading', () => {
|
||||
it('FE-MOB-AUSERS-003: the placeholders replaces the list while users are loading', () => {
|
||||
renderSection({ users: [ALICE], isLoading: true });
|
||||
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
expect(screen.queryByText('alice')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe('MAtlas', () => {
|
||||
it('FE-MOB-ATLASSCR-001: shows only a spinner while the atlas is loading', () => {
|
||||
it('FE-MOB-ATLASSCR-001: shows only placeholders while the atlas is loading', () => {
|
||||
setAtlas({ loading: true });
|
||||
render(<MAtlas />);
|
||||
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
expect(screen.queryByText('atlas.bucketTab')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ describe('MAtlas', () => {
|
||||
});
|
||||
render(<MAtlas />);
|
||||
|
||||
expect(document.querySelector('.animate-spin')).not.toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'atlas.bucketTab' })).toBeInTheDocument();
|
||||
// Stats card labels come from the real translations via useTranslation.
|
||||
expect(screen.getByText('Countries')).toBeInTheDocument();
|
||||
|
||||
@@ -69,11 +69,11 @@ describe('MCollTripPickerSheet', () => {
|
||||
expect(screen.getByText('Sun, Mar 1, 2020')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('FE-MOB-CTRIPP-004: the spinner holds the list until the trips arrive', async () => {
|
||||
it('FE-MOB-CTRIPP-004: the placeholders holds the list until the trips arrive', async () => {
|
||||
let resolve!: (v: { trips: typeof TRIPS }) => void
|
||||
vi.mocked(tripsApi.list).mockReturnValue(new Promise(r => { resolve = r }))
|
||||
setup()
|
||||
expect(document.querySelector('.animate-spin')).not.toBeNull()
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeNull()
|
||||
expect(screen.queryByText('No trips yet')).not.toBeInTheDocument()
|
||||
|
||||
resolve({ trips: TRIPS })
|
||||
|
||||
@@ -209,12 +209,12 @@ describe('MCollections', () => {
|
||||
mocks.coll = makeHook()
|
||||
})
|
||||
|
||||
it('FE-MOB-COLSCR-001: shows only the spinner while the first load is in flight', () => {
|
||||
it('FE-MOB-COLSCR-001: shows only the placeholders while the first load is in flight', () => {
|
||||
mocks.coll = makeHook({ loading: true, collections: [], places: [], visiblePlaces: [] })
|
||||
render(<MCollections />)
|
||||
|
||||
expect(screen.queryByPlaceholderText('collections.search')).not.toBeInTheDocument()
|
||||
expect(document.querySelector('.animate-spin')).not.toBeNull()
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeNull()
|
||||
})
|
||||
|
||||
it('FE-MOB-COLSCR-002: with no lists at all the dock + button starts the first one; the screen has no button of its own', async () => {
|
||||
@@ -465,7 +465,7 @@ describe('MCollections', () => {
|
||||
|
||||
mocks.coll = makeHook({ places: [], visiblePlaces: [], placesLoading: true })
|
||||
const loadingView = render(<MCollections />)
|
||||
expect(loadingView.container.querySelector('.animate-spin')).not.toBeNull()
|
||||
expect(loadingView.container.querySelector('[data-skeleton]')).not.toBeNull()
|
||||
|
||||
mocks.coll = makeHook({ places: [], visiblePlaces: [] })
|
||||
render(<MCollections />)
|
||||
|
||||
@@ -57,16 +57,16 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe('MJourney', () => {
|
||||
it('FE-MOB-JLIST-001: shows a spinner while the first load is running', () => {
|
||||
it('FE-MOB-JLIST-001: shows placeholders while the first load is running', () => {
|
||||
setup({ loading: true, journeys: [] });
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Other journeys')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-JLIST-002: shows the mascot empty state when there are no journeys', () => {
|
||||
setup();
|
||||
expect(screen.getByText('Create a new Journey')).toBeInTheDocument();
|
||||
expect(document.querySelector('.animate-spin')).not.toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-JLIST-003: renders the active journey as hero with its counters', () => {
|
||||
|
||||
@@ -265,9 +265,9 @@ describe('MJourneyDetail', () => {
|
||||
expect(document.querySelector('.h-\\[196px\\]')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('FE-MOB-JDET-001: shows a spinner while the journey is loading', () => {
|
||||
it('FE-MOB-JDET-001: shows placeholders while the journey is loading', () => {
|
||||
setup({ loading: true, current: null });
|
||||
expect(document.querySelector('.animate-spin')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-skeleton]')).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('journey-map')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
|
||||
@@ -67,11 +67,11 @@ describe('MPlacesSaveToCollectionSheet', () => {
|
||||
expect(screen.getAllByText('0 places')).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('FE-MOB-PSAVE-003: shows the spinner until the lists arrive', async () => {
|
||||
it('FE-MOB-PSAVE-003: shows the placeholders until the lists arrive', async () => {
|
||||
let resolve!: (v: CollectionListResponse) => void
|
||||
vi.spyOn(collectionsApi, 'list').mockReturnValue(new Promise(r => { resolve = r }))
|
||||
renderSheet()
|
||||
expect(document.querySelector('.animate-spin')).not.toBeNull()
|
||||
expect(document.querySelector('[data-skeleton]')).not.toBeNull()
|
||||
expect(screen.queryByText('You have no lists yet')).not.toBeInTheDocument()
|
||||
resolve(listResponse([FAVORITES]))
|
||||
expect(await screen.findByText('Favorites')).toBeInTheDocument()
|
||||
|
||||
Reference in New Issue
Block a user