Skip to content

fix(API): prevent a reset/remove when passing an empty string#2900

Merged
csouchet merged 2 commits into
masterfrom
fix/check_empty_string_parameter
Oct 2, 2023
Merged

fix(API): prevent a reset/remove when passing an empty string#2900
csouchet merged 2 commits into
masterfrom
fix/check_empty_string_parameter

Conversation

@tbouffard

@tbouffard tbouffard commented Sep 29, 2023

Copy link
Copy Markdown
Member

This fix applies to the "remove all CSS classes" and "reset style" APIs.

These two methods are intended to apply to all elements when a "nullish" parameter is passed. However, they previously applied to the empty string because the condition was checking the "falsy" state instead.

New tests have been added to reproduce the problem and validate the fix.

This applies to the "remove all CSS classes" and "reset style" APIs.

These two methods are intended to apply to all elements when a nullish parameter is passed.
However, they previously applied to the empty string because the condition was checking the "falsy" state instead.

New tests have been added to reproduce the problem and validate the fix.
@tbouffard tbouffard added the bug Something isn't working label Sep 29, 2023
@github-actions

github-actions Bot commented Sep 29, 2023

Copy link
Copy Markdown

♻️ PR Preview ad2dfb5 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@github-actions

github-actions Bot commented Sep 29, 2023

Copy link
Copy Markdown

♻️ PR Preview ad2dfb5 has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@tbouffard tbouffard changed the title fix(API): do not reset/remove when passing an empty string fix(API): prevent a reset/remove when passing an empty string Oct 2, 2023
@tbouffard tbouffard marked this pull request as ready for review October 2, 2023 07:18
@tbouffard tbouffard requested a review from csouchet October 2, 2023 07:18
resetStyle(bpmnElementIds: string | string[]): void {
this.graph.batchUpdate(() => {
if (bpmnElementIds) {
if (bpmnElementIds || bpmnElementIds == '') {

@tbouffard tbouffard Oct 2, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: we may introduce a function to manage this check
It could improve readability while eliminating duplication (which is not really mandatory here).

@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2023

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@csouchet csouchet merged commit 324d4c1 into master Oct 2, 2023
@csouchet csouchet deleted the fix/check_empty_string_parameter branch October 2, 2023 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants