Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web-components-wrapper): don't generate default props for empty strings #469

Merged
merged 3 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/main/scripts/create-web-components-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ resolvedWebComponents.forEach((componentSpec) => {

propTypes.push(dedent`
/**
* ${property.description}
* ${property.description
.replace(/\n\n<br><br> /g, '<br/><br/>\n *\n * ')
.replace(/\n\n/g, '<br/><br/>\n *\n * ')}
*/
${property.name}?: ${tsType.tsType};
`);
Expand All @@ -603,7 +605,7 @@ resolvedWebComponents.forEach((componentSpec) => {
defaultProps.push(`${property.name}: ${property.defaultValue === 'true'}`);
} else if (tsType.isEnum === true) {
defaultProps.push(`${property.name}: ${tsType.tsType}.${property.defaultValue.replace(/['"]/g, '')}`);
} else {
} else if (tsType.tsType !== 'string' || (tsType.tsType === 'string' && property.defaultValue !== '""')) {
defaultProps.push(`${property.name}: ${property.defaultValue}`);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
exports[`ActionSheet Render without Crashing 1`] = `
<ui5-responsive-popover
class="ActionSheet-actionSheet-0 myCustomClass"
header-text=""
horizontal-align="Center"
initial-focus=""
placement-type="Right"
vertical-align="Center"
>
Expand All @@ -19,14 +17,12 @@ exports[`ActionSheet Render without Crashing 1`] = `
<ui5-button
data-is-action-sheet-button=""
design="Transparent"
icon=""
>
Reject
</ui5-button>
<ui5-button
data-is-action-sheet-button=""
design="Transparent"
icon=""
>
This is my super long text!
</ui5-button>
Expand All @@ -36,16 +32,13 @@ exports[`ActionSheet Render without Crashing 1`] = `
exports[`ActionSheet does not crash with other component 1`] = `
<ui5-responsive-popover
class="ActionSheet-actionSheet-0"
header-text=""
horizontal-align="Center"
initial-focus=""
placement-type="Right"
vertical-align="Center"
>
<ui5-label
data-is-action-sheet-button=""
design="Transparent"
for=""
>
I should not crash
</ui5-label>
Expand Down
Loading