diff --git a/js/actions/windowActions.js b/js/actions/windowActions.js index b03cceafd13..211c83bccb2 100644 --- a/js/actions/windowActions.js +++ b/js/actions/windowActions.js @@ -1201,9 +1201,9 @@ const windowActions = { }) }, - onTabClose: function (data) { + onTabClosedWithMouse: function (data) { dispatch({ - actionType: windowConstants.WINDOW_TAB_CLOSE, + actionType: windowConstants.WINDOW_TAB_CLOSED_WITH_MOUSE, data }) }, diff --git a/js/components/tab.js b/js/components/tab.js index 21e04505349..c7e7f461169 100644 --- a/js/components/tab.js +++ b/js/components/tab.js @@ -103,9 +103,9 @@ class Tab extends ImmutableComponent { windowActions.setActiveFrame(this.frame) } - onCloseFrame (event) { + onTabClosedWithMouse (event) { event.stopPropagation() - this.props.onFrameClose(this.tabNode.parentNode.getBoundingClientRect()) + this.props.onTabClosedWithMouse(this.tabNode.parentNode.getBoundingClientRect()) windowActions.closeFrame(windowStore.getFrames(), this.frame) } @@ -142,7 +142,7 @@ class Tab extends ImmutableComponent { onClickTab (e) { // Middle click should close tab if (e.button === 1) { - this.onCloseFrame(e) + this.onTabClosedWithMouse(e) } else { this.setActiveFrame(e) } @@ -256,7 +256,7 @@ class Tab extends ImmutableComponent { } { !this.isPinned - ? : null diff --git a/js/components/tabs.js b/js/components/tabs.js index f6a6a6ffbb8..00328bcca6e 100644 --- a/js/components/tabs.js +++ b/js/components/tabs.js @@ -28,7 +28,7 @@ class Tabs extends ImmutableComponent { this.onNewTabLongPress = this.onNewTabLongPress.bind(this) this.wasNewTabClicked = this.wasNewTabClicked.bind(this) this.onMouseLeave = this.onMouseLeave.bind(this) - this.onFrameClose = this.onFrameClose.bind(this) + this.onTabClosedWithMouse = this.onTabClosedWithMouse.bind(this) } onMouseLeave () { @@ -37,8 +37,8 @@ class Tabs extends ImmutableComponent { }) } - onFrameClose (rect) { - windowActions.onTabClose({ + onTabClosedWithMouse (rect) { + windowActions.onTabClosedWithMouse({ fixTabWidth: rect.width }) } @@ -140,7 +140,7 @@ class Tabs extends ImmutableComponent { paintTabs={this.props.paintTabs} previewTabs={this.props.previewTabs} isActive={this.props.activeFrameKey === tab.get('frameKey')} - onFrameClose={this.onFrameClose} + onTabClosedWithMouse={this.onTabClosedWithMouse} tabWidth={this.props.fixTabWidth} partOfFullPageSet={this.props.partOfFullPageSet} />) } diff --git a/js/constants/windowConstants.js b/js/constants/windowConstants.js index 62b17ab20d6..5d0b1fb93df 100644 --- a/js/constants/windowConstants.js +++ b/js/constants/windowConstants.js @@ -89,7 +89,7 @@ const windowConstants = { WINDOW_WIDEVINE_PANEL_DETAIL_CHANGED: _, WINDOW_AUTOFILL_SELECTION_CLICKED: _, WINDOW_AUTOFILL_POPUP_HIDDEN: _, - WINDOW_TAB_CLOSE: _, + WINDOW_TAB_CLOSED_WITH_MOUSE: _, WINDOW_TAB_MOUSE_LEAVE: _ } diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index a0f151d67d4..ff598784e92 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -747,7 +747,7 @@ const doAction = (action) => { case appConstants.APP_NEW_TAB: newFrame(action.frameProps, action.frameProps.get('disposition') === 'foreground-tab') break - case windowConstants.WINDOW_TAB_CLOSE: + case windowConstants.WINDOW_TAB_CLOSED_WITH_MOUSE: if (frameStateUtil.getNonPinnedFrameCount(windowState) % getSetting(settings.TABS_PER_PAGE) === 0) { windowState = windowState.deleteIn(['ui', 'tabs', 'fixTabWidth']) } else { diff --git a/test/unit/state/frameStateUtilTest.js b/test/unit/state/frameStateUtilTest.js index 5a8fed10ad6..670b1fb69e6 100644 --- a/test/unit/state/frameStateUtilTest.js +++ b/test/unit/state/frameStateUtilTest.js @@ -287,7 +287,7 @@ describe('frameStateUtil', function () { }) it('returns 0 with only pinned frames', function () { this.windowState = Immutable.fromJS(Object.assign({}, defaultWindowStore.toJS())) - assert.equal(frameStateUtil.getNonPinnedFrameCount(Immutable.fromJS({frames: [{title:'153,409th prime', pinnedLocation: 'http://www.brave.com/2064737'}]})), 0) + assert.equal(frameStateUtil.getNonPinnedFrameCount(Immutable.fromJS({frames: [{title: '153,409th prime', pinnedLocation: 'http://www.brave.com/2064737'}]})), 0) }) it('returns 1 with a frame and a pinned frames', function () { this.windowState = Immutable.fromJS(Object.assign({}, defaultWindowStore.toJS()))