Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Apr 17, 2024
2 parents a678f5b + a512f81 commit 9e072fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions components/popover/__tests__/index.test.tsx
Expand Up @@ -28,6 +28,15 @@ describe('Popover', () => {
expect(container.querySelector('.ant-popover-inner-content')).toBeTruthy();
});

it('should support defaultOpen', () => {
const { container } = render(
<Popover title="code" defaultOpen>
<span>show me your code</span>
</Popover>,
);
expect(container.querySelector('.ant-popover')).toBeTruthy();
});

it('shows content for render functions', () => {
const renderTitle = () => 'some-title';
const renderContent = () => 'some-content';
Expand Down
1 change: 1 addition & 0 deletions components/popover/index.tsx
Expand Up @@ -60,6 +60,7 @@ const InternalPopover = React.forwardRef<TooltipRef, PopoverProps>((props, ref)
const overlayCls = classNames(overlayClassName, hashId, cssVarCls);
const [open, setOpen] = useMergedState(false, {
value: props.open ?? props.visible,
defaultValue: props.defaultOpen ?? props.defaultVisible,
});

const settingOpen = (
Expand Down
3 changes: 2 additions & 1 deletion components/theme/util/calc/CSSCalculator.ts
Expand Up @@ -2,6 +2,8 @@ import AbstractCalculator from './calculator';

const CALC_UNIT = 'CALC_UNIT';

const regexp = new RegExp(CALC_UNIT, 'g');

function unit(value: string | number) {
if (typeof value === 'number') {
return `${value}${CALC_UNIT}`;
Expand Down Expand Up @@ -77,7 +79,6 @@ export default class CSSCalculator extends AbstractCalculator {

equal(options?: { unit?: boolean }): string {
const { unit: cssUnit = true } = options || {};
const regexp = new RegExp(`${CALC_UNIT}`, 'g');
this.result = this.result.replace(regexp, cssUnit ? 'px' : '');
if (typeof this.lowPriority !== 'undefined') {
return `calc(${this.result})`;
Expand Down

0 comments on commit 9e072fb

Please sign in to comment.