Skip to content

Commit 4e06bbf

Browse files
committed
fix(mosaic): keep the styles of the element passed to SearchTarget
1 parent e54dd93 commit 4e06bbf

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { cleanup, render, screen } from '@testing-library/react';
2+
import { afterEach, expect, it } from 'vitest';
3+
4+
import { SearchTarget } from '../profile-search-target';
5+
6+
afterEach(() => cleanup());
7+
8+
it('keeps the styles of the element passed as `render`', () => {
9+
render(
10+
<>
11+
<style>{'@layer app { .usage-card { padding: 16px; margin: 8px; } }'}</style>
12+
<SearchTarget
13+
id='rate-limits'
14+
render={<section className='usage-card' />}
15+
>
16+
Rate limits
17+
</SearchTarget>
18+
</>,
19+
);
20+
21+
const target = getComputedStyle(screen.getByText('Rate limits'));
22+
expect(target.padding).toBe('16px');
23+
expect(target.margin).toBe('8px');
24+
});

‎packages/mosaic/src/components/profile/profile-search-target.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const SearchTarget = React.forwardRef<HTMLDivElement, SearchTargetProps>(
3232
defaultTagName: 'div',
3333
render,
3434
ref: [ref, target.ref],
35-
props: target.props(stylex.props(reset.base, xstyle), rest),
35+
props: target.props(stylex.props(xstyle), rest),
3636
});
3737
});
3838

0 commit comments

Comments
 (0)