Skip to content

Commit 3381113

Browse files
unit test fixes
1 parent 1e03ad2 commit 3381113

File tree

13 files changed

+33
-23
lines changed

13 files changed

+33
-23
lines changed

client/config/test/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default {
2727
"@dnd-kit/sortable": path.resolve(currentDir, "./mocks/dnd-kit-sortable.js"),
2828
"@dnd-kit/core": path.resolve(currentDir, "./mocks/dnd-kit-core.js"),
2929
"antd": path.resolve(currentDir, "./mocks/antd.js"),
30+
"@rjsf/antd": path.resolve(currentDir, "./mocks/rjsf-antd.js"),
3031
"history": path.resolve(currentDir, "./mocks/history.js"),
3132
"\\.md\\?url$": path.resolve(currentDir, "./mocks/markdown-url-module.js"),
3233
"^@lowcoder-ee(.*)$": path.resolve(

client/config/test/mocks/rjsf-antd.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default jest.unstable_mockModule("@rjsf/antd", () => ({
2+
Theme: jest.fn(),
3+
}));

client/packages/lowcoder/src/components/InputList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { default as Form } from "antd/es/form";
2+
import { default as FormItem } from "antd/es/form/FormItem";
23
import { FormListProps, Rule } from "antd/lib/form";
34
import { TacoButton } from "lowcoder-design";
45
import { Input } from "lowcoder-design";
@@ -9,7 +10,7 @@ import { useEffect } from "react";
910
import { useForm } from "antd/lib/form/Form";
1011
import { trans } from "i18n";
1112

12-
const StyledItem = styled(Form.Item)`
13+
const StyledItem = styled(FormItem)`
1314
margin-bottom: 8px;
1415
&:last-child {
1516
margin-bottom: 2px;

client/packages/lowcoder/src/components/TextArea.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import styled from "styled-components";
2-
import { default as AntdInput } from "antd/es/input";
3-
import { TextAreaRef, TextAreaProps as AntdTextAreaProps } from "antd/es/input/TextArea";
2+
import { default as AntdTextArea, TextAreaRef, TextAreaProps as AntdTextAreaProps } from "antd/es/input/TextArea";
43
import { ChangeEvent, useEffect, useRef, useState } from "react";
54
import _ from "lodash";
65
import React from "react";
76
import { INPUT_DEFAULT_ONCHANGE_DEBOUNCE } from "constants/perf";
87

9-
const StyledTextArea = styled(AntdInput.TextArea)``;
8+
const StyledTextArea = styled(AntdTextArea)``;
109

1110
export interface TextAreaProps extends AntdTextAreaProps {
1211
debounce?: number;

client/packages/lowcoder/src/components/TypographyText.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { default as Typography } from "antd/es/typography";
1+
import { default as AntdTypographyText } from "antd/es/typography/Text";
22
import React from "react";
33
import styled from "styled-components";
44

5-
const AntdTypographyText = styled(Typography.Text)`
5+
const StyledTypographyText = styled(AntdTypographyText)`
66
font-size: 14px;
77
color: #333333;
88
line-height: 14px;
@@ -44,7 +44,7 @@ export const TypographyText = (props: {
4444
editing: boolean;
4545
onChange: (value: string) => void;
4646
}) => (
47-
<AntdTypographyText
47+
<StyledTypographyText
4848
title={props.value}
4949
ellipsis={true}
5050
editable={{
@@ -57,5 +57,5 @@ export const TypographyText = (props: {
5757
}}
5858
>
5959
{props.value}
60-
</AntdTypographyText>
60+
</StyledTypographyText>
6161
);

client/packages/lowcoder/src/comps/comps/buttonComp/dropdownComp.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { default as Menu } from "antd/es/menu";
22
import { default as Dropdown } from "antd/es/dropdown";
3+
import { default as DropdownButton } from "antd/es/dropdown/dropdown-button";
34
import { BoolControl } from "comps/controls/boolControl";
45
import { BoolCodeControl, StringControl } from "comps/controls/codeControl";
56
import { ButtonStyleType } from "comps/controls/styleControlConstants";
@@ -22,7 +23,7 @@ import {
2223
} from "./buttonCompConstants";
2324

2425

25-
const DropdownButton = styled(Dropdown.Button)`
26+
const StyledDropdownButton = styled(DropdownButton)`
2627
width: 100%;
2728
.ant-btn-group {
2829
width: 100%;
@@ -104,7 +105,7 @@ const DropdownTmpComp = (function () {
104105
</Button100>
105106
</Dropdown>
106107
) : (
107-
<DropdownButton
108+
<StyledDropdownButton
108109
disabled={props.disabled}
109110
dropdownRender={() => menu}
110111
onClick={() => props.onEvent("click")}
@@ -123,7 +124,7 @@ const DropdownTmpComp = (function () {
123124
>
124125
{/* Avoid button disappearing */}
125126
{!props.text || props.text?.length === 0 ? " " : props.text}
126-
</DropdownButton>
127+
</StyledDropdownButton>
127128
)}
128129
</ButtonCompWrapper>
129130
);

client/packages/lowcoder/src/comps/comps/dateComp/dateRangeUIView.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import { default as DatePicker } from "antd/es/date-picker";
1111
import { hasIcon } from "comps/utils";
1212
import { omit } from "lodash";
1313

14-
const RangePickerStyled = styled(DatePicker.RangePicker)<{ $style: DateTimeStyleType }>`
14+
const { RangePicker } = DatePicker;
15+
16+
const RangePickerStyled = styled((props: any) => <RangePicker {...props} />)<{ $style: DateTimeStyleType }>`
1517
width: 100%;
1618
${(props) => props.$style && getStyle(props.$style)}
1719
`;
@@ -46,8 +48,8 @@ export const DateRangeUIView = (props: DateRangeUIViewProps) => {
4648
{...omit(props, "onChange")}
4749
ref={props.viewRef as any}
4850
value={[props.start, props.end]}
49-
disabledDate={(current) => disabledDate(current, props.minDate, props.maxDate)}
50-
onCalendarChange={(time) => {
51+
disabledDate={(current: any) => disabledDate(current, props.minDate, props.maxDate)}
52+
onCalendarChange={(time: any) => {
5153
props.onChange(time?.[0], time?.[1]);
5254
}}
5355
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}

client/packages/lowcoder/src/comps/comps/jsonSchemaFormComp/jsonSchemaFormComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { hiddenPropertyView } from "comps/utils/propertyUtils";
2727
import { useContext } from "react";
2828
import { EditorContext } from "comps/editorState";
2929

30+
console.log('THEME', Theme);
3031
Theme.widgets.DateWidget = DateWidget(false);
3132
Theme.widgets.DateTimeWidget = DateWidget(true);
3233
const Form = withTheme(Theme);

client/packages/lowcoder/src/comps/comps/layout/navLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { default as Layout } from "antd/es/layout";
2+
import { default as LayoutSider } from "antd/es/layout/Sider";
23
import { default as AntdMenu, MenuProps } from "antd/es/menu";
34
import { default as Segmented } from "antd/es/segmented";
45
import MainContent from "components/layout/MainContent";
@@ -43,7 +44,7 @@ import {
4344
const DEFAULT_WIDTH = 240;
4445
type MenuItemStyleOptionValue = "normal" | "hover" | "active";
4546

46-
const StyledSide = styled(Layout.Sider)`
47+
const StyledSide = styled(LayoutSider)`
4748
max-height: calc(100vh - ${TopHeaderHeight});
4849
overflow: auto;
4950

client/packages/lowcoder/src/comps/comps/selectInputComp/checkboxComp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { default as Checkbox } from "antd/es/checkbox";
1+
import { default as AntdCheckboxGroup } from "antd/es/checkbox/Group";
22
import { SelectInputOptionControl } from "comps/controls/optionsControl";
33
import { BoolCodeControl } from "../../controls/codeControl";
44
import { arrayStringExposingStateControl } from "../../controls/codeStateControl";
@@ -73,7 +73,7 @@ export const getStyle = (style: CheckboxStyleType) => {
7373
`;
7474
};
7575

76-
const CheckboxGroup = styled(Checkbox.Group)<{
76+
const CheckboxGroup = styled(AntdCheckboxGroup)<{
7777
$style: CheckboxStyleType;
7878
$layout: ValueFromOption<typeof RadioLayoutOptions>;
7979
}>`

client/packages/lowcoder/src/comps/comps/selectInputComp/radioComp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { default as AntdRadio } from "antd/es/radio";
1+
import { default as AntdRadioGroup } from "antd/es/radio/group";
22
import { RadioStyleType } from "comps/controls/styleControlConstants";
33
import styled, { css } from "styled-components";
44
import { UICompBuilder } from "../../generators";
@@ -52,7 +52,7 @@ const getStyle = (style: RadioStyleType) => {
5252
`;
5353
};
5454

55-
const Radio = styled(AntdRadio.Group)<{
55+
const Radio = styled(AntdRadioGroup)<{
5656
$style: RadioStyleType;
5757
$layout: ValueFromOption<typeof RadioLayoutOptions>;
5858
}>`

client/packages/lowcoder/src/comps/comps/textInputComp/passwordComp.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { default as Input, InputRef } from "antd/es/input";
1+
import { default as InputPassword } from "antd/es/input/Password";
2+
import { InputRef } from "antd/es/input";
23
import {
34
NameConfig,
45
NameConfigPlaceHolder,
@@ -40,7 +41,7 @@ import { RefControl } from "comps/controls/refControl";
4041
import React, { useContext } from "react";
4142
import { EditorContext } from "comps/editorState";
4243

43-
const PasswordStyle = styled(Input.Password)<{
44+
const PasswordStyle = styled(InputPassword)<{
4445
$style: InputLikeStyleType;
4546
}>`
4647
${(props) => props.$style && getStyle(props.$style)}

client/packages/lowcoder/src/pages/ApplicationV2/HomeTableView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { HomeResTypeEnum } from "../../types/homeRes";
1313
import React, { useState } from "react";
1414
import { updateFolder } from "../../redux/reduxActions/folderActions";
1515
import { updateAppMetaAction } from "../../redux/reduxActions/applicationActions";
16-
import { default as Typography } from "antd/es/typography";
16+
import { default as AntdTypographyText } from "antd/es/typography/Text";
1717
import { HomeRes } from "./HomeLayout";
1818
import { HomeResOptions } from "./HomeResOptions";
1919
import { MoveToFolderModal } from "./MoveToFolderModal";
@@ -44,7 +44,7 @@ const EditBtn = styled(TacoButton)`
4444
height: 24px;
4545
`;
4646

47-
const TypographyText = styled(Typography.Text)`
47+
const TypographyText = styled(AntdTypographyText)`
4848
margin: 0 !important;
4949
left: 0 !important;
5050
width: 100%;

0 commit comments

Comments
 (0)