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

Commit

Permalink
Add missing breakpoint tests for tab content
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Apr 20, 2017
1 parent e6b76bb commit 94790ed
Show file tree
Hide file tree
Showing 4 changed files with 393 additions and 25 deletions.
86 changes: 81 additions & 5 deletions test/unit/app/renderer/components/tabs/content/closeTabIconTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,29 @@ describe('Tabs content - CloseTabIcon', function () {
mockery.disable()
})

it('should show closeTab icon if mouse is over tab', function () {
it('should show closeTab icon if mouse is over tab and breakpoint is default', function () {
const wrapper = shallow(
<CloseTabIcon
tab={
Immutable.Map({
hoverState: true
hoverState: true,
breakpoint: 'default'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'closeTabIcon')
})
it('should not show closeTab icon if mouse is not over a tab', function () {
it('should show closeTab icon if mouse is over tab and breakpoint is large', function () {
const wrapper = shallow(
<CloseTabIcon
tab={
Immutable.Map({
hoverState: false
hoverState: true,
breakpoint: 'large'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'closeTabIcon')
assert.equal(wrapper.props()['data-test-id'], 'closeTabIcon')
})
it('should not show closeTab icon if tab is pinned', function () {
const wrapper = shallow(
Expand All @@ -60,6 +62,80 @@ describe('Tabs content - CloseTabIcon', function () {
)
assert.notEqual(wrapper.props()['data-test-id'], 'closeTabIcon')
})
it('should show closeTab icon if tab size is largeMedium and tab is active', function () {
const wrapper = shallow(
<CloseTabIcon isActive
tab={
Immutable.Map({
hoverState: false,
breakpoint: 'largeMedium'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'closeTabIcon')
})
it('should not show closeTab icon if tab size is largeMedium and tab is not active', function () {
const wrapper = shallow(
<CloseTabIcon isActive={false}
tab={
Immutable.Map({
hoverState: true,
breakpoint: 'largeMedium'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'closeTabIcon')
})

it('should show closeTab icon if tab size is medium and tab is active', function () {
const wrapper = shallow(
<CloseTabIcon isActive
tab={
Immutable.Map({
hoverState: false,
breakpoint: 'medium'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'closeTabIcon')
})
it('should not show closeTab icon if tab size is medium and tab is not active', function () {
const wrapper = shallow(
<CloseTabIcon isActive={false}
tab={
Immutable.Map({
hoverState: true,
breakpoint: 'medium'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'closeTabIcon')
})

it('should show closeTab icon if tab size is mediumSmall and tab is active', function () {
const wrapper = shallow(
<CloseTabIcon isActive
tab={
Immutable.Map({
hoverState: false,
breakpoint: 'mediumSmall'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'closeTabIcon')
})
it('should not show closeTab icon if tab size is mediumSmall and tab is not active', function () {
const wrapper = shallow(
<CloseTabIcon isActive={false}
tab={
Immutable.Map({
hoverState: true,
breakpoint: 'mediumSmall'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'closeTabIcon')
})
it('should show closeTab icon if tab size is small and tab is active', function () {
const wrapper = shallow(
<CloseTabIcon isActive
Expand Down
117 changes: 111 additions & 6 deletions test/unit/app/renderer/components/tabs/content/newSessionIconTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,139 @@ describe('Tabs content - NewSessionIcon', function () {
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if mouse is over tab (avoid icon overflow)', function () {
it('should not show new session icon if mouse is over tab and breakpoint is default', function () {
const wrapper = shallow(
<NewSessionIcon
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: true
hoverState: true,
breakpoint: 'default'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if tab size is small', function () {
it('should show new session icon if mouse is not over tab and breakpoint is default', function () {
const wrapper = shallow(
<NewSessionIcon
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: false,
breakpoint: 'default'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if mouse is over tab and breakpoint is large', function () {
const wrapper = shallow(
<NewSessionIcon
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: true,
breakpoint: 'small'
breakpoint: 'large'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if tab size is extraSmall', function () {
it('should show new session icon if mouse is not over tab and breakpoint is large', function () {
const wrapper = shallow(
<NewSessionIcon
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: false,
breakpoint: 'large'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if tab is active and breakpoint is largeMedium', function () {
const wrapper = shallow(
<NewSessionIcon isActive
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: true,
breakpoint: 'largeMedium'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should show new session icon if tab is not active and breakpoint is largeMedium', function () {
const wrapper = shallow(
<NewSessionIcon isActive={false}
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: false,
breakpoint: 'largeMedium'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if tab is active and breakpoint is medium', function () {
const wrapper = shallow(
<NewSessionIcon isActive
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: true,
breakpoint: 'medium'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should show new session icon if tab is not active and breakpoint is medium', function () {
const wrapper = shallow(
<NewSessionIcon isActive={false}
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: false,
breakpoint: 'medium'
})}
/>
)
assert.equal(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if breakpoint is mediumSmall', function () {
const wrapper = shallow(
<NewSessionIcon isActive
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: false,
breakpoint: 'mediumSmall'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if breakpoint is small', function () {
const wrapper = shallow(
<NewSessionIcon isActive
tab={
Immutable.Map({
partitionNumber: 1,
hoverState: true,
breakpoint: 'small'
})}
/>
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if breakpoint is extraSmall', function () {
const wrapper = shallow(
<NewSessionIcon isActive
tab={
Immutable.Map({
partitionNumber: 1,
Expand All @@ -86,7 +191,7 @@ describe('Tabs content - NewSessionIcon', function () {
)
assert.notEqual(wrapper.props()['data-test-id'], 'newSessionIcon')
})
it('should not show new session icon if tab size is the smallest', function () {
it('should not show new session icon if breakpoint is the smallest', function () {
const wrapper = shallow(
<NewSessionIcon
tab={
Expand Down
Loading

0 comments on commit 94790ed

Please sign in to comment.