Skip to content

Commit

Permalink
test(ui5-breadcrumbs): fix false-positive event listener tests (#4584)
Browse files Browse the repository at this point in the history
Two tests checking for item-click event are passing, although the eventlistener isn't called in the test run, probably due to the noConflict configuration here:
  • Loading branch information
hardl authored Jan 17, 2022
1 parent 42254d8 commit 2294cb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/main/test/pages/Breadcrumbs.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ <h2>Empty Breadcrumbs with Location only</h2>
});

// log events
breadcrumbs1.addEventListener("item-click", (event) => {result.innerText = event.detail.item.innerText});
breadcrumbs1.addEventListener("ui5-item-click", (event) => {result.innerText = event.detail.item.innerText});

extendSizeBtn.addEventListener("click", () => resizeContainer(true));
shrinkSizeBtn.addEventListener("click", () => resizeContainer());
Expand Down
9 changes: 5 additions & 4 deletions packages/main/test/specs/Breadcrumbs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ describe("Breadcrumbs general interaction", () => {

// Check
const eventResult = await browser.$("#result");
assert.strictEqual(eventResult.innerText, link.innerText, "label for pressed link is correct");
assert.isNotEmpty(await eventResult.getText(), 'label should have a value');
assert.strictEqual(await eventResult.getText(), await link.getText(), "label for pressed link is correct");
});

it("fires link-click event when link in overflow", async () => {
const breadcrumbs = await browser.$("#breadcrumbs1"),
overflowArrowLink = (await breadcrumbs.shadow$$("ui5-link"))[0],
link = (await breadcrumbs.shadow$$("ui5-link"))[1];
overflowArrowLink = (await breadcrumbs.shadow$$("ui5-link"))[0];


// Act
Expand All @@ -50,7 +50,8 @@ describe("Breadcrumbs general interaction", () => {

// Check
const eventResult = await browser.$("#result");
assert.strictEqual(eventResult.innerText, link.innerText, "label for pressed link is correct");
assert.isNotEmpty(await eventResult.getText(), 'label should have a value');
assert.strictEqual(await eventResult.getText(), await firstItem.getProperty('innerText'), "label for pressed link is correct");
});

it("updates layout on container resize", async () => {
Expand Down

0 comments on commit 2294cb2

Please sign in to comment.