upgrade to tamagui v2 and guest pwa overhaul
This commit is contained in:
@@ -48,6 +48,37 @@ vi.mock('@/components/ui/collapsible', () => ({
|
||||
CollapsibleTrigger: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||
}));
|
||||
|
||||
vi.mock('@/components/ui/tabs', () => {
|
||||
const TabsContext = React.createContext<{ value: string; setValue: (value: string) => void }>({
|
||||
value: '',
|
||||
setValue: () => {},
|
||||
});
|
||||
|
||||
return {
|
||||
Tabs: ({ value, onValueChange, children }: { value: string; onValueChange: (value: string) => void; children: React.ReactNode }) => (
|
||||
<TabsContext.Provider value={{ value, setValue: onValueChange }}>
|
||||
<div>{children}</div>
|
||||
</TabsContext.Provider>
|
||||
),
|
||||
TabsList: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||
TabsTrigger: ({ value, children }: { value: string; children: React.ReactNode }) => {
|
||||
const { setValue } = React.useContext(TabsContext);
|
||||
return (
|
||||
<button type="button" onClick={() => setValue(value)}>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
},
|
||||
TabsContent: ({ value, children }: { value: string; children: React.ReactNode }) => {
|
||||
const { value: activeValue } = React.useContext(TabsContext);
|
||||
if (activeValue !== value) {
|
||||
return null;
|
||||
}
|
||||
return <div>{children}</div>;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock('@/lib/utils', () => ({
|
||||
cn: (...args: Array<string | boolean | undefined>) => args.filter(Boolean).join(' '),
|
||||
}));
|
||||
@@ -81,12 +112,15 @@ describe('AuthStep OAuth controls', () => {
|
||||
it('hides the OAuth buttons when switching to login mode', () => {
|
||||
render(<AuthStep privacyHtml="" />);
|
||||
|
||||
expect(screen.getByText('checkout.auth_step.continue_with_google')).toBeInTheDocument();
|
||||
expect(screen.getByText('checkout.auth_step.continue_with_facebook')).toBeInTheDocument();
|
||||
const googleButton = screen.getByText('checkout.auth_step.continue_with_google');
|
||||
const facebookButton = screen.getByText('checkout.auth_step.continue_with_facebook');
|
||||
|
||||
expect(googleButton).toBeInTheDocument();
|
||||
expect(facebookButton).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(screen.getByText('checkout.auth_step.switch_to_login'));
|
||||
|
||||
expect(screen.queryByText('checkout.auth_step.continue_with_google')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('checkout.auth_step.continue_with_facebook')).not.toBeInTheDocument();
|
||||
expect(googleButton).not.toBeVisible();
|
||||
expect(facebookButton).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user