diff --git a/src/swap/components/SwapSettingsSlippageLayout.test.tsx b/src/swap/components/SwapSettingsSlippageLayout.test.tsx index b1ab9b10fd..3723f45b8b 100644 --- a/src/swap/components/SwapSettingsSlippageLayout.test.tsx +++ b/src/swap/components/SwapSettingsSlippageLayout.test.tsx @@ -24,8 +24,11 @@ vi.mock('./SwapSettingsSlippageInput', () => ({ SwapSettingsSlippageInput: () =>
Input
, })); -vi.mock('../../styles/theme', () => ({ - cn: (...args: string[]) => args.join(' '), +vi.mock('../styles/theme', () => ({ + cn: (...args) => args.join(' '), + background: { default: 'bg-default' }, + border: { default: 'border-default' }, + pressable: { shadow: 'pressable-shadow' }, })); describe('SwapSettingsSlippageLayout', () => { @@ -46,55 +49,4 @@ describe('SwapSettingsSlippageLayout', () => { expect(screen.getByTestId('mock-description')).toBeInTheDocument(); expect(screen.getByTestId('mock-input')).toBeInTheDocument(); }); - - it('renders with only some child components', () => { - render( - - Title - , - ); - expect( - screen.getByTestId('ockSwapSettingsLayout_container'), - ).toBeInTheDocument(); - expect(screen.getByTestId('mock-title')).toBeInTheDocument(); - expect(screen.queryByTestId('mock-description')).not.toBeInTheDocument(); - expect(screen.queryByTestId('mock-input')).not.toBeInTheDocument(); - }); - - it('applies custom className', () => { - render( - - Title - , - ); - const container = screen.getByTestId('ockSwapSettingsLayout_container'); - expect(container.className).toContain('custom-class'); - }); - - it('renders without any child components', () => { - render(); - expect( - screen.getByTestId('ockSwapSettingsLayout_container'), - ).toBeInTheDocument(); - expect(screen.queryByTestId('mock-title')).not.toBeInTheDocument(); - expect(screen.queryByTestId('mock-description')).not.toBeInTheDocument(); - expect(screen.queryByTestId('mock-toggle')).not.toBeInTheDocument(); - expect(screen.queryByTestId('mock-input')).not.toBeInTheDocument(); - }); - - it('renders with correct layout structure', () => { - render( - - Title - - Description - - - , - ); - const container = screen.getByTestId('ockSwapSettingsLayout_container'); - expect(container.children[0]).toHaveTextContent('Title'); - expect(container.children[1]).toHaveTextContent('Description'); - expect(container.children[2].children[0]).toHaveTextContent('Input'); - }); }); diff --git a/src/swap/components/SwapSettingsSlippageLayout.tsx b/src/swap/components/SwapSettingsSlippageLayout.tsx index fd0f4d31c1..5a31cb9795 100644 --- a/src/swap/components/SwapSettingsSlippageLayout.tsx +++ b/src/swap/components/SwapSettingsSlippageLayout.tsx @@ -1,6 +1,6 @@ import { Children, useMemo } from 'react'; import { findComponent } from '../../internal/utils/findComponent'; -import { cn } from '../../styles/theme'; +import { background, border, cn, pressable } from '../../styles/theme'; import type { SwapSettingsSlippageLayoutReact } from '../types'; import { SwapSettingsSlippageDescription } from './SwapSettingsSlippageDescription'; import { SwapSettingsSlippageInput } from './SwapSettingsSlippageInput'; @@ -24,8 +24,10 @@ export function SwapSettingsSlippageLayout({ return (
({ SwapSettingsSlippageInput: () =>
Input
, })); -vi.mock('../../styles/theme', () => ({ - cn: (...args: string[]) => args.join(' '), +vi.mock('../styles/theme', () => ({ + cn: (...args) => args.join(' '), + background: { default: 'bg-default' }, + border: { default: 'border-default' }, + pressable: { shadow: 'pressable-shadow' }, })); describe('SwapSettingsSlippageLayoutBottomSheet', () => { diff --git a/src/swap/components/SwapSettingsSlippageLayoutBottomSheet.tsx b/src/swap/components/SwapSettingsSlippageLayoutBottomSheet.tsx index 03e19b3c0d..b05fe36147 100644 --- a/src/swap/components/SwapSettingsSlippageLayoutBottomSheet.tsx +++ b/src/swap/components/SwapSettingsSlippageLayoutBottomSheet.tsx @@ -1,6 +1,6 @@ import { Children, useMemo } from 'react'; import { findComponent } from '../../internal/utils/findComponent'; -import { cn } from '../../styles/theme'; +import { background, border, cn, color, pressable } from '../../styles/theme'; import type { SwapSettingsSlippageLayoutReact } from '../types'; import { SwapSettingsSlippageDescription } from './SwapSettingsSlippageDescription'; import { SwapSettingsSlippageInput } from './SwapSettingsSlippageInput'; @@ -24,15 +24,22 @@ export function SwapSettingsSlippageLayoutBottomSheet({ return (
-
+
-

Settings

+

Settings

@@ -41,7 +48,12 @@ export function SwapSettingsSlippageLayoutBottomSheet({ {input &&
{input}
}
-
+
);