Skip to content

Commit 48505d9

Browse files
fix(web-components-wrapper): don't generate default props for empty strings (#469)
1 parent b21b1f0 commit 48505d9

File tree

94 files changed

+193
-1212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+193
-1212
lines changed

packages/main/scripts/create-web-components-wrapper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,9 @@ resolvedWebComponents.forEach((componentSpec) => {
593593

594594
propTypes.push(dedent`
595595
/**
596-
* ${property.description}
596+
* ${property.description
597+
.replace(/\n\n<br><br> /g, '<br/><br/>\n *\n * ')
598+
.replace(/\n\n/g, '<br/><br/>\n *\n * ')}
597599
*/
598600
${property.name}?: ${tsType.tsType};
599601
`);
@@ -603,7 +605,7 @@ resolvedWebComponents.forEach((componentSpec) => {
603605
defaultProps.push(`${property.name}: ${property.defaultValue === 'true'}`);
604606
} else if (tsType.isEnum === true) {
605607
defaultProps.push(`${property.name}: ${tsType.tsType}.${property.defaultValue.replace(/['"]/g, '')}`);
606-
} else {
608+
} else if (tsType.tsType !== 'string' || (tsType.tsType === 'string' && property.defaultValue !== '""')) {
607609
defaultProps.push(`${property.name}: ${property.defaultValue}`);
608610
}
609611
}

packages/main/src/components/ActionSheet/__snapshots__/ActionSheet.test.tsx.snap

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
exports[`ActionSheet Render without Crashing 1`] = `
44
<ui5-responsive-popover
55
class="ActionSheet-actionSheet-0 myCustomClass"
6-
header-text=""
76
horizontal-align="Center"
8-
initial-focus=""
97
placement-type="Right"
108
vertical-align="Center"
119
>
@@ -19,14 +17,12 @@ exports[`ActionSheet Render without Crashing 1`] = `
1917
<ui5-button
2018
data-is-action-sheet-button=""
2119
design="Transparent"
22-
icon=""
2320
>
2421
Reject
2522
</ui5-button>
2623
<ui5-button
2724
data-is-action-sheet-button=""
2825
design="Transparent"
29-
icon=""
3026
>
3127
This is my super long text!
3228
</ui5-button>
@@ -36,16 +32,13 @@ exports[`ActionSheet Render without Crashing 1`] = `
3632
exports[`ActionSheet does not crash with other component 1`] = `
3733
<ui5-responsive-popover
3834
class="ActionSheet-actionSheet-0"
39-
header-text=""
4035
horizontal-align="Center"
41-
initial-focus=""
4236
placement-type="Right"
4337
vertical-align="Center"
4438
>
4539
<ui5-label
4640
data-is-action-sheet-button=""
4741
design="Transparent"
48-
for=""
4942
>
5043
I should not crash
5144
</ui5-label>

0 commit comments

Comments
 (0)