mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
fix(mobile): a booking opens its detail sheet first, as a transport and the desktop do; Wallet and Map buttons read short
Bookings in the Bookings tab, the day sheet, a place's sheet and the road trip opened their editor straight away, while a transport showed its details with a pencil to edit. Every booking now opens the same detail sheet; its edit and delete follow the booking's own permission (reservation_edit for a stay, a table or a ticket, day_edit for a transport). Notes keep opening for editing, as on the desktop. The wallet button reads "Wallet" (its accessible name still says which one), and "On map" reads "Map" in every language.
This commit is contained in:
@@ -61,12 +61,14 @@ describe('MWalletButton', () => {
|
||||
await waitFor(() => expect(onError).toHaveBeenLastCalledWith(expect.stringMatching(/could not be made/i)));
|
||||
});
|
||||
|
||||
it('on Android adds the booking to Google Wallet, under its own name', async () => {
|
||||
it('on Android adds the booking to Google Wallet, under its own name for screen readers', async () => {
|
||||
wallet.kind = 'google';
|
||||
wallet.addGoogle.mockResolvedValue('added');
|
||||
const onError = vi.fn();
|
||||
render(<MWalletButton tripId={42} reservationId={7} onError={onError} />);
|
||||
expect(screen.getByRole('button')).toHaveTextContent(/Google Wallet/);
|
||||
// The label is short, the accessible name says which wallet.
|
||||
expect(screen.getByRole('button')).toHaveTextContent(/^Wallet$/);
|
||||
expect(screen.getByRole('button', { name: /Google Wallet/ })).toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button'));
|
||||
await waitFor(() => expect(wallet.addGoogle).toHaveBeenCalledWith(42, 7, expect.any(String)));
|
||||
expect(wallet.add).not.toHaveBeenCalled();
|
||||
|
||||
@@ -57,10 +57,11 @@ export default function MWalletButton({ tripId, reservationId, onError, classNam
|
||||
onClick={() => void add()}
|
||||
disabled={busy}
|
||||
aria-busy={busy}
|
||||
aria-label={t(wallet === 'google' ? 'reservations.wallet.addGoogle' : 'reservations.wallet.add')}
|
||||
className="flex items-center gap-[6px] rounded-full bg-black px-3 py-[7px] text-[length:calc(12px*var(--fs-scale-body,1))] font-semibold text-white transition-transform active:scale-[.97] disabled:opacity-70" // theme-lint-disable: the wallets' badges are black in either theme
|
||||
>
|
||||
{busy ? <Loader2 size={13} className="animate-spin" /> : <Wallet size={13} strokeWidth={2} />}
|
||||
{t(wallet === 'google' ? 'reservations.wallet.addGoogle' : 'reservations.wallet.add')}
|
||||
{t('reservations.wallet.short')}
|
||||
</button>
|
||||
);
|
||||
return className ? <div className={className}>{button}</div> : button;
|
||||
|
||||
Reference in New Issue
Block a user