Skip to content

Commit b04db63

Browse files
committed
fix(ui5-segmented-button-item): adopt inherited tooltip property (#4843)
The tooltip property, inherited from the Button has not been adopted. As a result we have a property in the API that does not have any effect. This is now fixed with the current PR. FIXES: #4840
1 parent 057a7d8 commit b04db63

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

packages/main/src/Button.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ const metadata = {
113113
},
114114

115115
/**
116-
* Defines the tooltip of the button.
116+
* Defines the tooltip of the component.
117117
* <br>
118-
* <b>Note:</b> Tooltips should only be set to icon-only buttons.
118+
* <b>Note:</b> We recommend setting tooltip to icon-only components.
119119
* @type {string}
120120
* @defaultvalue: ""
121121
* @public

packages/main/src/SegmentedButtonItem.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@touchend="{{_ontouchend}}"
2121
tabindex={{tabIndexValue}}
2222
aria-label="{{ariaLabelText}}"
23-
title="{{title}}"
23+
title="{{tooltip}}"
2424
>
2525
{{#if icon}}
2626
<ui5-icon

packages/main/test/pages/SegmentedButton.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h2>Segmentedbutton example</h2>
3232

3333
<section>
3434
<ui5-segmented-button id="segButton1">
35-
<ui5-segmented-button-item icon="employee" pressed></ui5-segmented-button-item>
35+
<ui5-segmented-button-item tooltip="Employee" icon="employee" pressed></ui5-segmented-button-item>
3636
<ui5-segmented-button-item>SegmentedButtonItem</ui5-segmented-button-item>
3737
<ui5-segmented-button-item>Item</ui5-segmented-button-item>
3838
</ui5-segmented-button>

packages/main/test/specs/SegmentedButton.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ describe("SegmentedButton general interaction", () => {
66
await browser.url(`http://localhost:${PORT}/test-resources/pages/SegmentedButton.html`);
77
});
88

9-
it("tests if pressed attribute is applied", async () => {
9+
it("tests if pressed and tooltip attributes are applied", async () => {
1010
const segmentedButtonItem = await browser.$("#segButton1 > ui5-segmented-button-item:first-child");
11+
const segmentedButtonItemInner = await segmentedButtonItem.shadow$(".ui5-button-root");
1112

1213
assert.ok(await segmentedButtonItem.getProperty("pressed"), "SegmentedButtonItem has property pressed");
14+
assert.strictEqual(await segmentedButtonItemInner.getProperty("title"), "Employee",
15+
"SegmentedButtonItem root element has property title");
1316
});
1417

18+
1519
it("tests if pressed attribute is switched to the newly pressed item when selected with enter key", async () => {
1620
const firstSegmentedButtonItem = await browser.$("#segButton1 > ui5-segmented-button-item:first-child");
1721
const secondSegmentedButtonItem = await browser.$("#segButton1 > ui5-segmented-button-item:nth-child(2)");

0 commit comments

Comments
 (0)