Skip to content

Commit fff4426

Browse files
authored
fix(tabs): spread style prop (#11981)
* fix(tabs): spread style prop * chore(tabs): remove testing border * chore(tabs): spread style prop better * chore(tabs): nothing to see here * chore(tabs): add test
1 parent 033c30a commit fff4426

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

packages/react-core/src/components/Tabs/Tabs.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,12 @@ class Tabs extends Component<TabsProps, TabsState> {
576576
)}
577577
{...getOUIAProps(Tabs.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe)}
578578
id={id && id}
579-
style={{ [linkAccentLength.name]: currentLinkAccentLength, [linkAccentStart.name]: currentLinkAccentStart }}
580579
{...props}
580+
style={{
581+
[linkAccentLength.name]: currentLinkAccentLength,
582+
[linkAccentStart.name]: currentLinkAccentStart,
583+
...props.style
584+
}}
581585
>
582586
{expandable && isVertical && (
583587
<GenerateId>

packages/react-core/src/components/Tabs/__tests__/Tabs.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,3 +562,15 @@ test('should render an enabled add button', () => {
562562
const addButton = screen.getByLabelText('add-label');
563563
expect(addButton).not.toBeDisabled();
564564
});
565+
566+
test(`should render with custom inline style and accent position inline style`, () => {
567+
render(
568+
<Tabs role="region" style="background-color: #12345;">
569+
<Tab title="Test title" eventKey={0}>
570+
Tab Content
571+
</Tab>
572+
</Tabs>
573+
);
574+
575+
expect(screen.getByRole('region')).toHaveStyle(`background-color: #12345;--pf-v6-c-tabs--link-accent--start: 0px;`);
576+
});

0 commit comments

Comments
 (0)