Skip to content

Commit

Permalink
[tooltip] added test for arrow colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyabrower committed Jul 10, 2024
1 parent 1c1ed67 commit 21d84b6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions semcore/tooltip/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ describe('Tooltip', () => {

await expect(await snapshot(component)).toMatchImageSnapshot(task);
});

test.concurrent('Renders correctly with changed color for arrow', async ({ task }) => {
const component = (
<div style={{ width: '100px', height: '100px' }}>
<Tooltip visible disablePortal>
<Tooltip.Trigger>
<button type='button'>Test</button>
</Tooltip.Trigger>
<Tooltip.Popper arrowBgColor={'green'} arrowShadowColor={'grey'}>text text text</Tooltip.Popper>
</Tooltip>
</div>
);

await expect(await snapshot(component)).toMatchImageSnapshot(task);
});
});

describe('Tooltip.Trigger', () => {
Expand Down
2 changes: 1 addition & 1 deletion semcore/tooltip/src/Tooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function TooltipPopper(props) {
data-popper-arrow
use:theme={resolveColor(theme)}
bgColor={arrowBgColor}
shadowColor={arrowShadowColor}
shadowColor={arrowShadowColor ?? arrowBgColor}
/>
</STooltip>
</STooltipPortalledWrapper>
Expand Down
6 changes: 3 additions & 3 deletions semcore/tooltip/src/style/tooltip.shadow.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ SArrow[theme='warning'] {
}
}

SArrow[bgColor] {
border-color: var(--bgColor);
SArrow[bgColor][shadowColor] {
border-color: var(--shadowColor);

&::before {
border-color: var(--shadowColor, --bgColor);
border-color: var(--bgColor);
}
}

Expand Down

0 comments on commit 21d84b6

Please sign in to comment.