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-tabcontainer): Fix overflow visibility #1993

Merged
merged 1 commit into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/main/src/TabContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ class TabContainer extends UI5Element {
this._updateScrolling();
}

_closeRespPopover() {
async _closeRespPopover() {
this.responsivePopover = await this._respPopover();
this.responsivePopover.close();
}

Expand All @@ -456,6 +457,10 @@ class TabContainer extends UI5Element {
this._scrollable = headerScrollContainer.offsetWidth < headerScrollContainer.scrollWidth;
this._scrollableBack = headerScrollContainer.scrollLeft > 0;
this._scrollableForward = Math.ceil(headerScrollContainer.scrollLeft) < headerScrollContainer.scrollWidth - headerScrollContainer.offsetWidth;

if (!this._scrollable) {
this._closeRespPopover();
}
}

_getHeader() {
Expand Down
18 changes: 18 additions & 0 deletions packages/main/test/specs/TabContainer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ describe("TabContainer general interaction", () => {

assert.ok(!arrowLeft.isDisplayed(), "'Left Arrow' should be hidden after 'Left arrow' click");
assert.ok(arrowRight.isDisplayed(), "'Right Arrow' should be visible after 'Left arrow' click");

// act: open overflow
const overflowBtn = browser.$("#tabContainerTextOnly").shadow$(".ui-tc__overflowButton");
overflowBtn.click();

// assert: the overflow popover is open.
const staticAreaItemClassName = browser.getStaticAreaItemClassName("#tabContainerTextOnly")
const overflowPopover = browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
assert.strictEqual(overflowPopover.isDisplayedInViewport(), true,
"Popover is open.");

// act: resize, so the overflow button is not visible
browser.setWindowSize(1400, 1080);
browser.pause(500);

// assert: the overflow popover is closed.
assert.strictEqual(overflowPopover.isDisplayedInViewport(), false,
"Popover is closed.");
});

it("tests if content is scrollable when tabcontainer takes limited height by its parent", () => {
Expand Down