Skip to content

Commit

Permalink
chore: merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 4, 2024
2 parents 1ae0ef3 + e3664ee commit 9effc00
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"semver": "^7.6.3",
"standard-changelog": "^2.0.27",
"start-server-and-test": "^1.14.0",
"tdesign-icons-view": "^0.3.0",
"tdesign-publish-cli": "^0.0.12",
Expand Down
2 changes: 2 additions & 0 deletions site/src/components/codesandbox/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ export const pkgContent = JSON.stringify(
'react-scripts': '^5.0.0',
'@types/react': orgPkg.devDependencies['@types/react'],
'@types/react-dom': orgPkg.devDependencies['@types/react-dom'],
lodash: orgPkg.dependencies.lodash,
},
devDependencies: {
typescript: '^4.4.4',
'@types/lodash': orgPkg.devDependencies['@types/lodash'],
},
scripts: {
start: 'react-scripts start',
Expand Down
5 changes: 4 additions & 1 deletion src/checkbox/CheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ const CheckboxGroup = <T extends CheckboxGroupValue = CheckboxGroupValue>(props:
const intervalOptions =
Array.isArray(options) && options.length > 0
? options
: React.Children.map(children, (child) => (child as ReactElement).props) || [];
: React.Children.map(
children,
(child: JSX.Element) => child?.type?.displayName === Checkbox.displayName && (child as ReactElement).props,
) || [];

const optionsWithoutCheckAll = intervalOptions.filter((t) => typeof t !== 'object' || !t.checkAll);
const optionsWithoutCheckAllValues = [];
Expand Down
2 changes: 1 addition & 1 deletion src/image-viewer/ImageViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ImageViewer: React.FC<ImageViewerProps> = (originalProps) => {

const imageViewerAttach = useAttach('imageViewer', attach);
const [visible, setVisible] = useControlled(props, 'visible', (visible, context) => {
isFunction(props.onClose) && props.onClose(context);
!visible && props?.onClose?.(context);
});

const [visibled, setVisibled] = useState(false);
Expand Down
10 changes: 5 additions & 5 deletions src/image-viewer/__tests__/image-viewer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('ImageViewer', () => {
});

// 鼠标点击后,有元素
expect(onClose).toHaveBeenCalledTimes(1);
expect(onClose).toHaveBeenCalledTimes(0);
const imgModal = document.querySelector('.t-image-viewer__modal-pic');
expect(imgModal).toBeTruthy();

Expand All @@ -39,7 +39,7 @@ describe('ImageViewer', () => {
fireEvent.click(closeBtn);
});
// 点击后,没有元素存在
expect(onClose).toHaveBeenCalledTimes(2);
expect(onClose).toHaveBeenCalledTimes(1);
await mockTimeout(() => expect(document.querySelector('.t-image-viewer-preview-image')).toBeNull());
});

Expand Down Expand Up @@ -122,7 +122,7 @@ describe('ImageViewerMini', () => {
act(() => {
fireEvent.click(closeBtn);
});
expect(onClose).toHaveBeenCalledTimes(2);
expect(onClose).toHaveBeenCalledTimes(1);
});
});

Expand Down Expand Up @@ -153,7 +153,7 @@ describe('ImageViewerModal', () => {

// 模拟键盘事件
await user.type(document.body, '{Escape}');
expect(onClose).toHaveBeenCalledTimes(2);
expect(onClose).toHaveBeenCalledTimes(1);

await user.type(document.body, '{ArrowRight}');
expect(onIndexChange).toHaveBeenCalledTimes(1);
Expand All @@ -166,7 +166,7 @@ describe('ImageViewerModal', () => {
act(() => {
fireEvent.click(mask);
});
expect(onClose).toHaveBeenCalledTimes(3);
expect(onClose).toHaveBeenCalledTimes(2);
});

test('single', async () => {
Expand Down

0 comments on commit 9effc00

Please sign in to comment.