Skip to content

Commit 7494c45

Browse files
committed
Review: Update generator tests
1 parent 4fbb954 commit 7494c45

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

packages/pluggable-widgets-tools/src/typings-generator/__tests__/inputs/file.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export const fileInput = `<?xml version="1.0" encoding="utf-8"?>
1616
<caption>File 3</caption>
1717
<description />
1818
</property>
19+
<property key="file4" type="file" allowUpload="true" required="false">
20+
<caption>File 4</caption>
21+
<description />
22+
</property>
1923
</propertyGroup>
2024
<propertyGroup caption="Actions">
2125
<property key="description" type="attribute">
@@ -57,6 +61,10 @@ export const fileInputNative = `<?xml version="1.0" encoding="utf-8"?>
5761
<caption>File 3</caption>
5862
<description />
5963
</property>
64+
<property key="file4" type="file" allowUpload="true" required="false">
65+
<caption>File 4</caption>
66+
<description />
67+
</property>
6068
</propertyGroup>
6169
<propertyGroup caption="Actions">
6270
<property key="description" type="attribute">

packages/pluggable-widgets-tools/src/typings-generator/__tests__/outputs/file.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface MyWidgetContainerProps {
1212
file: DynamicValue<FileValue>;
1313
file2?: DynamicValue<FileValue>;
1414
file3: EditableFileValue;
15+
file4?: EditableFileValue;
1516
description: EditableValue<string>;
1617
action?: ActionValue;
1718
}
@@ -23,6 +24,7 @@ export interface MyWidgetPreviewProps {
2324
file: string;
2425
file2: string;
2526
file3: string;
27+
file4: string;
2628
description: string;
2729
action: {} | null;
2830
}
@@ -33,6 +35,7 @@ export const fileNativeOutput = `export interface MyWidgetProps<Style> {
3335
file: DynamicValue<FileValue>;
3436
file2?: DynamicValue<FileValue>;
3537
file3: EditableFileValue;
38+
file4?: EditableFileValue;
3639
description: EditableValue<string>;
3740
action?: ActionValue;
3841
}`;

packages/pluggable-widgets-tools/src/typings-generator/generateClientTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ function toClientPropType(
128128
return "number";
129129
case "decimal":
130130
return "Big";
131-
case "icon":
131+
case "icon":
132132
return isNative ? "DynamicValue<NativeIcon>" : "DynamicValue<WebIcon>";
133-
case "image":
133+
case "image":
134134
return isNative ? "DynamicValue<NativeImage>" : prop.$.allowUpload === "true" ? "EditableImageValue<WebImage>" : "DynamicValue<WebImage>";
135135
case "file":
136136
return prop.$.allowUpload ? "EditableFileValue" : "DynamicValue<FileValue>";

0 commit comments

Comments
 (0)