Skip to content

Commit

Permalink
fix(ui5-shellbar-item): Update count properly (#2049)
Browse files Browse the repository at this point in the history
Fixes #2048
  • Loading branch information
fifoosid authored Aug 3, 2020
1 parent c6fcf69 commit 2499c56
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/fiori/src/ShellBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const metadata = {
"default": {
propertyName: "items",
type: HTMLElement,
invalidateParent: true,
},

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/fiori/test/pages/ShellBar.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ <h3>ShellBar in Compact</h3>
<ui5-li id="mi-4"slot="menuItems" data-key="key4">App 4</ui5-li>
</ui5-shellbar>

<ui5-shellbar primary-title="UI5 Web Components" id="test-invalidation">
<ui5-shellbar-item icon="discussion" count="2" id="test-invalidation-item"/>
</ui5-shellbar>

<script>
mySearch.addEventListener("suggestionItemSelect", function (event) {
 console.log(event);
Expand Down
10 changes: 10 additions & 0 deletions packages/fiori/test/specs/ShellBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ describe("Component Behavior", () => {
const icon = shellbar.shadow$("ui5-button[data-count]");

assert.strictEqual(icon.getAttribute("data-count"), '42', "Count property propagates to ui5-button");
});

it("tests if shellbar item invalidates the shellbar", () => {
const shellbar = browser.$("#test-invalidation");
const item = browser.$("#test-invalidation-item");

item.setProperty("count", "3");

assert.strictEqual(shellbar.shadow$(".ui5-shellbar-custom-item").getAttribute("data-count"), "3");

})
});

Expand Down

0 comments on commit 2499c56

Please sign in to comment.