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

Tweak tabtitle threshold w/ secondary icons on small tabs #9512

Merged
merged 1 commit into from
Jun 19, 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 app/common/state/tabContentState.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ const tabContentState = {
// If closeIcon is fixed then there's no room for another icon
!tabContentState.hasFixedCloseIcon(state, frameKey) &&
// completely hide it for small sizes
!hasBreakpoint(frame.get('breakpoint'), ['mediumSmall', 'small', 'extraSmall', 'smallest'])
!hasBreakpoint(frame.get('breakpoint'),
['medium', 'mediumSmall', 'small', 'extraSmall', 'smallest'])
Copy link
Contributor

@NejcZdovc NejcZdovc Jun 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checkout my PR that refactored this function and I see that medium was not there before either. How come that we need to add it now? Was this working correctly before in previous versions or never?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the feature works as expected but turns out to have bad UI. It wasn't introduced in your PR.

)
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/components/tabs/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Tab extends React.Component {
props.partOfFullPageSet = ownProps.partOfFullPageSet
props.showTitle = !props.isPinnedTab &&
!(
(hasBreakpoint(breakpoint, 'small') && props.isActive) ||
(hasBreakpoint(breakpoint, ['mediumSmall', 'small']) && props.isActive) ||
hasBreakpoint(breakpoint, ['extraSmall', 'smallest'])
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,6 @@ describe('Tabs content - NewSessionIcon', function () {
assert.equal(wrapper.find('NewSessionIcon').length, 1)
})

it('icon if tab is not active and breakpoint is medium', function () {
windowStore.state = defaultWindowStore.merge({
activeFrameKey: 0,
frames: [{
partitionNumber: 1,
hoverState: false,
breakpoint: 'medium'
}]
})
const wrapper = mount(<Tab frameKey={frameKey} />)
assert.equal(wrapper.find('NewSessionIcon').length, 1)
})

it('partition number for new sessions', function () {
windowStore.state = defaultWindowStore.mergeIn(['frames', 0], {
partitionNumber: 3,
Expand Down Expand Up @@ -199,10 +186,10 @@ describe('Tabs content - NewSessionIcon', function () {
assert.equal(wrapper.find('NewSessionIcon').length, 0)
})

it('if tab is active and breakpoint is medium', function () {
it('if breakpoint is medium', function () {
windowStore.state = defaultWindowStore.mergeIn(['frames', 0], {
partitionNumber: 1,
hoverState: true,
hoverState: false,
breakpoint: 'medium'
})
const wrapper = mount(<Tab frameKey={frameKey} />)
Expand Down
17 changes: 2 additions & 15 deletions test/unit/app/renderer/components/tabs/content/privateIconTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,6 @@ describe('Tabs content - PrivateIcon', function () {
assert.equal(wrapper.find('PrivateIcon').length, 1)
})

it('if tab is not active and breakpoint is medium', function () {
windowStore.state = defaultWindowStore.merge({
activeFrameKey: 0,
frames: [{
isPrivate: true,
hoverState: false,
breakpoint: 'medium'
}]
})
const wrapper = mount(<Tab frameKey={frameKey} />)
assert.equal(wrapper.find('PrivateIcon').length, 1)
})

it('if mouse is not over tab and breakpoint is default', function () {
windowStore.state = defaultWindowStore.mergeIn(['frames', 0], {
isPrivate: true,
Expand Down Expand Up @@ -171,10 +158,10 @@ describe('Tabs content - PrivateIcon', function () {
assert.equal(wrapper.find('PrivateIcon').length, 0)
})

it('if tab is active and breakpoint is medium', function () {
it('if breakpoint is medium', function () {
windowStore.state = defaultWindowStore.mergeIn(['frames', 0], {
isPrivate: true,
hoverState: true,
hoverState: false,
breakpoint: 'medium'
})
const wrapper = mount(<Tab frameKey={frameKey} />)
Expand Down
23 changes: 17 additions & 6 deletions test/unit/app/renderer/components/tabs/content/tabTitleTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ describe('Tabs content - Title', function () {
const wrapper = mount(<Tab frameKey={frameKey} />)
assert.equal(wrapper.find('TabTitle div').text(), pageTitle1)
})
it('if breakpoint is mediumSmall', function () {
windowStore.state = defaultWindowStore.mergeIn(['frames', 0], {
location: url1,
title: pageTitle1,
breakpoint: 'mediumSmall'
it('if breakpoint is mediumSmall and tab is not active', function () {
windowStore.state = defaultWindowStore.merge({
activeFrameKey: 0,
frames: [{
location: url1,
title: pageTitle1,
breakpoint: 'mediumSmall'
}]
})
const wrapper = mount(<Tab frameKey={frameKey} />)
assert.equal(wrapper.find('TabTitle div').text(), pageTitle1)
Expand Down Expand Up @@ -147,7 +150,15 @@ describe('Tabs content - Title', function () {
const wrapper = mount(<Tab frameKey={frameKey} />)
assert.equal(wrapper.find('TabTitle').length, 0)
})

it('if breakpoint is mediumSmall and tab is active', function () {
windowStore.state = defaultWindowStore.mergeIn(['frames', 0], {
location: url1,
title: pageTitle1,
breakpoint: 'mediumSmall'
})
const wrapper = mount(<Tab frameKey={frameKey} />)
assert.equal(wrapper.find('TabTitle').length, 0)
})
it('if breakpoint is small and tab is active', function () {
windowStore.state = defaultWindowStore.mergeIn(['frames', 0], {
location: url1,
Expand Down