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

feat!: allow changing the icon #4594

Merged
merged 6 commits into from
May 10, 2024
Merged

feat!: allow changing the icon #4594

merged 6 commits into from
May 10, 2024

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Jan 24, 2023

Description

Icon is missing a setter for the icon

Warning

Note, it's a minor behavior altering change because the default constructor is changed to not set the default icon.

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/contributing/overview
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

@sonarcloud
Copy link

sonarcloud bot commented Jan 24, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Apr 21, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@vursen vursen left a comment

Choose a reason for hiding this comment

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

Allowing the developer to change the icon sounds reasonable to me. I'm slightly concerned that there is a chance someone would request a getter in the future as there is currently no way to know what icon the component displays. I wonder what such a getter could look like given the current setter API.

public String getCollection();
public String getIcon();

Copy link
Contributor

@vursen vursen left a comment

Choose a reason for hiding this comment

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

We discussed this PR internally and arrived at the following outcome:

  • setIcon(String icon) should re-use the previous collection. It can be unexpected otherwise that setIcon(String icon) resets the collection to ICON_COLLECTION_NAME for Icons initialized with a custom collection.
  • setIcon(VaadinIcon icon) is also required. Using VaadinIcon is pretty common among Flow developers.
  • The new API should be covered with unit tests.

@yuriy-fix
Copy link
Contributor

Closing the PR as stale as the last review comments have not been addressed in over a month. Please don't hesitate to open a new PR if you want to continue with this contribution. Thanks!

@yuriy-fix yuriy-fix closed this Jul 20, 2023
@Artur- Artur- reopened this May 8, 2024
@Artur-
Copy link
Member Author

Artur- commented May 8, 2024

Updated based on review comments

@Artur- Artur- requested a review from vursen May 10, 2024 05:51
…aadin/flow/component/icon/Icon.java

Co-authored-by: Sergey Vinogradov <[email protected]>
@vursen vursen changed the title feat: Allow changing the icon feat!: allow changing the icon May 10, 2024
}

@Test
public void canSetNewVaadinIcon() {
Copy link
Contributor

@vursen vursen May 10, 2024

Choose a reason for hiding this comment

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

nit: Since getCollection is a public method, it would be great to have a test for it too

@vursen vursen enabled auto-merge (squash) May 10, 2024 12:32
Copy link

sonarcloud bot commented May 10, 2024

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@vursen vursen merged commit 3cf51f0 into main May 10, 2024
5 checks passed
@vursen vursen deleted the change-icon branch May 10, 2024 12:43
vaadin-bot pushed a commit that referenced this pull request May 10, 2024
web-padawan pushed a commit that referenced this pull request May 10, 2024
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.5.0.alpha1 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants