mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
refactor: inline-style to cssinjs (#51843)
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
* refactor: inline-style to cssinjs * fix: fix test case * fix: fix * Update components/upload/Upload.tsx Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * rename * fix: fix --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
parent
4dbb0075bb
commit
cbfe7fb454
@ -941,8 +941,7 @@ exports[`Form form should support disabled 1`] = `
|
||||
class="ant-upload-wrapper"
|
||||
>
|
||||
<div
|
||||
class="ant-upload ant-upload-select ant-upload-disabled"
|
||||
style="display: none;"
|
||||
class="ant-upload ant-upload-select ant-upload-disabled ant-upload-hidden"
|
||||
>
|
||||
<span
|
||||
class="ant-upload ant-upload-disabled"
|
||||
|
@ -469,12 +469,13 @@ const InternalUpload: React.ForwardRefRenderFunction<UploadRef, UploadProps> = (
|
||||
);
|
||||
}
|
||||
|
||||
const uploadButtonCls = classNames(prefixCls, `${prefixCls}-select`, {
|
||||
const uploadBtnCls = classNames(prefixCls, `${prefixCls}-select`, {
|
||||
[`${prefixCls}-disabled`]: mergedDisabled,
|
||||
[`${prefixCls}-hidden`]: !children,
|
||||
});
|
||||
|
||||
const uploadButton = (
|
||||
<div className={uploadButtonCls} style={children ? undefined : { display: 'none' }}>
|
||||
<div className={uploadBtnCls}>
|
||||
<RcUpload {...rcUploadProps} ref={upload} />
|
||||
</div>
|
||||
);
|
||||
|
@ -5,8 +5,7 @@ exports[`Upload rtl render component should be rendered correctly in RTL directi
|
||||
class="ant-upload-wrapper ant-upload-rtl"
|
||||
>
|
||||
<div
|
||||
class="ant-upload ant-upload-select"
|
||||
style="display: none;"
|
||||
class="ant-upload ant-upload-select ant-upload-hidden"
|
||||
>
|
||||
<span
|
||||
class="ant-upload"
|
||||
|
@ -75,10 +75,7 @@ describe('Upload List', () => {
|
||||
mockHeightGet.mockImplementation(() => size.height);
|
||||
mockSrcSet.mockImplementation(function fn() {
|
||||
// @ts-ignore
|
||||
if (this.onload) {
|
||||
// @ts-ignore
|
||||
this.onload();
|
||||
}
|
||||
this.onload?.();
|
||||
});
|
||||
|
||||
mockGetCanvasContext.mockReturnValue({
|
||||
@ -1629,8 +1626,8 @@ describe('Upload List', () => {
|
||||
<Upload fileList={list as UploadProps['defaultFileList']} listType="picture-card" />,
|
||||
);
|
||||
expect(wrapper.querySelectorAll('.ant-upload-select').length).toBe(1);
|
||||
expect(wrapper.querySelectorAll<HTMLDivElement>('.ant-upload-select')[0]?.style.display).toBe(
|
||||
'none',
|
||||
expect(wrapper.querySelector<HTMLDivElement>('.ant-upload-select')).toHaveClass(
|
||||
'ant-upload-hidden',
|
||||
);
|
||||
unmount();
|
||||
});
|
||||
@ -1654,8 +1651,8 @@ describe('Upload List', () => {
|
||||
/>,
|
||||
);
|
||||
expect(wrapper.querySelectorAll('.ant-upload-select').length).toBe(1);
|
||||
expect(wrapper.querySelectorAll<HTMLDivElement>('.ant-upload-select')[0]?.style.display).toBe(
|
||||
'none',
|
||||
expect(wrapper.querySelector<HTMLDivElement>('.ant-upload-select')).toHaveClass(
|
||||
'ant-upload-hidden',
|
||||
);
|
||||
unmount();
|
||||
});
|
||||
|
@ -40,6 +40,10 @@ const genBaseStyle: GenerateStyle<UploadToken> = (token) => {
|
||||
display: 'inline-block',
|
||||
},
|
||||
|
||||
[`${componentCls}-hidden`]: {
|
||||
display: 'none',
|
||||
},
|
||||
|
||||
[`${componentCls}-disabled`]: {
|
||||
color: colorTextDisabled,
|
||||
cursor: 'not-allowed',
|
||||
|
Loading…
Reference in New Issue
Block a user