Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Show right number of tabs when closing with mouse on first tab in new… #9618

Merged
merged 1 commit into from
Jun 21, 2017
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
3 changes: 2 additions & 1 deletion js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@ const doAction = (action) => {
}
break
case windowConstants.WINDOW_TAB_CLOSED_WITH_MOUSE:
if (frameStateUtil.getNonPinnedFrameCount(windowState) % getSetting(settings.TABS_PER_PAGE) === 0) {
const frameCountAfterClose = frameStateUtil.getNonPinnedFrameCount(windowState) - 1
if (frameCountAfterClose % getSetting(settings.TABS_PER_PAGE) === 0) {
windowState = windowState.deleteIn(['ui', 'tabs', 'fixTabWidth'])
} else {
windowState = windowState.setIn(['ui', 'tabs', 'fixTabWidth'], action.data.fixTabWidth)
Expand Down
7 changes: 7 additions & 0 deletions test/lib/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,13 @@ var exports = {
})
})

this.app.client.addCommand('closeTabWithMouse', function () {
logVerbose('closeTabWithMouse()')
return this.execute(function () {
return devTools('electron').testData.windowActions.onTabClosedWithMouse()
})
})

this.app.client.addCommand('waitForInputText', function (selector, input) {
logVerbose('waitForInputText("' + selector + '", "' + input + '")')
return this
Expand Down
12 changes: 12 additions & 0 deletions test/tab-components/tabPagesTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ describe('tab pages', function () {
yield this.app.client.waitForVisible('[data-test-active-tab]')
})

it('shows the right number of tabs after closing with mouse', function * () {
const numTabsPerPage = appConfig.defaultSettings[settings.TABS_PER_PAGE]
const firstTabOfNewPageIndex = numTabsPerPage
yield this.app.client.click(newFrameButton)
.waitForElementCount(tabPage, 2)
.closeTabWithMouse()
.closeTabByIndex(firstTabOfNewPageIndex)
// No tab page indicator elements when 1 page
.waitForElementCount(tabPage, 0)
.waitForElementCount(tabsTabs, numTabsPerPage)
})

describe('allows changing to tab pages', function () {
beforeEach(function * () {
// Make sure there are 2 tab pages
Expand Down