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(ui5-button): set icon-only attribute (#2567) #2824

Merged
merged 2 commits into from
Mar 2, 2021
Merged

fix(ui5-button): set icon-only attribute (#2567) #2824

merged 2 commits into from
Mar 2, 2021

Conversation

xpr0gamers
Copy link
Contributor

Issue: When a ui5-button is created with blank text inside the component, for example
<ui5-button icon="message-information"> </ui5-button>, the attribute "icon-only" isn't set correctly.
Solution: Trim the node value when node is type of "TEXT_NODE" and check the length of the trimmed value.

FIXES: #2567

@CLAassistant
Copy link

CLAassistant commented Feb 16, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@vladitasev vladitasev left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Please see my comments about the blank text button. Otherwise, after a successful build, I'm good to +1 this PR.

@@ -29,7 +29,8 @@
</head>

<body style="background-color: var(--sapBackgroundColor);">
<ui5-button icon="home"><!----><!----></ui5-button>
<ui5-button icon="home" id="icon-only-comment"><!----><!----></ui5-button>
<ui5-button icon="text" id="icon-only-blank-text"></ui5-button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this example rather be > </ui5-button> (have a single space inside)?

@@ -378,7 +378,10 @@ class Button extends UI5Element {
}

get isIconOnly() {
return !Array.from(this.childNodes).filter(node => node.nodeType !== Node.COMMENT_NODE).length;
return !Array.from(this.childNodes).filter(node =>{
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ESLINT will require a space after the => operator here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right.

changes for ESLINT
@ilhan007 ilhan007 merged commit d834ec6 into SAP:master Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Icon only doesn't set its own attribute icon-only
4 participants