Skip to content

Commit

Permalink
test(Dimmer|Sidebar): add missing tests (#2978)
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter authored Jul 4, 2018
1 parent 61abfa5 commit e30a7fd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/specs/modules/Dimmer/DimmerInner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ describe('DimmerInner', () => {
common.propKeyOnlyToClassName(DimmerInner, 'inverted')
common.propKeyOnlyToClassName(DimmerInner, 'simple')

describe('active', () => {
it('adds "display: flex" after set to "true"', () => {
const wrapper = mount(<DimmerInner />)
wrapper.should.have.not.style('display')

wrapper.setProps({ active: true })
wrapper.should.have.style('display', 'flex')
})
})

describe('onClickOutside', () => {
it('called when Dimmer has not children', () => {
const onClickOutside = sandbox.spy()
Expand Down
9 changes: 9 additions & 0 deletions test/specs/modules/Sidebar/Sidebar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ describe('Sidebar', () => {
onHide.should.have.been.calledWithMatch({}, { visible: false })
})

it('is called when a click on the document was done only once', () => {
const onHide = sandbox.spy()
const wrapper = mount(<Sidebar onHide={onHide} visible />)

domEvent.click(document)
wrapper.setProps({ visible: false })
onHide.should.have.been.calledOnce()
})

it('is not called when a click was done inside the component', () => {
const mountNode = document.createElement('div')
const onHide = sandbox.spy()
Expand Down

0 comments on commit e30a7fd

Please sign in to comment.