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(API): prevent a reset/remove when passing an empty string #2900

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

tbouffard
Copy link
Member

@tbouffard tbouffard commented Sep 29, 2023

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
Copy link

github-actions bot commented Sep 29, 2023

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

🤖 By surge-preview

@github-actions
Copy link

github-actions bot commented Sep 29, 2023

♻️ 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
@@ -84,7 +84,7 @@ export class StyleUpdater {

resetStyle(bpmnElementIds: string | string[]): void {
this.graph.batchUpdate(() => {
if (bpmnElementIds) {
if (bpmnElementIds || bpmnElementIds == '') {
Copy link
Member Author

@tbouffard tbouffard Oct 2, 2023

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
Copy link

sonarqubecloud bot commented Oct 2, 2023

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