Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add tests
  • Loading branch information
mirka committed Feb 27, 2024
commit 65b9624934e23aed8733375fc019574920d6d7b6
10 changes: 10 additions & 0 deletions packages/components/src/h-stack/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ describe( 'props', () => {
);
expect( container ).toMatchSnapshot();
} );

test( 'should not pass through invalid props to the `as` component', () => {
const AsComponent = ( props: JSX.IntrinsicElements[ 'div' ] ) => {
return <div { ...props } />;
};

render( <HStack as={ AsComponent }>foobar</HStack> );

expect( console ).not.toHaveErrored();
} );
} );
10 changes: 10 additions & 0 deletions packages/components/src/v-stack/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ describe( 'props', () => {
);
expect( container ).toMatchSnapshot();
} );

test( 'should not pass through invalid props to the `as` component', () => {
const AsComponent = ( props: JSX.IntrinsicElements[ 'div' ] ) => {
return <div { ...props } />;
};

render( <VStack as={ AsComponent }>foobar</VStack> );

expect( console ).not.toHaveErrored();
} );
} );