-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed uncoverd lines for emoji-menu/get-style test. * New structure for correct testing. * Added index test for emoji-menu.
- Loading branch information
1 parent
056ae90
commit 3e27d06
Showing
4 changed files
with
91 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Radium from 'radium'; | ||
import compose from 'recompose/compose'; | ||
import onClickOutside from 'react-onclickoutside'; | ||
import themeable from '../themeable'; | ||
import EmojiMenu from './component'; | ||
|
||
const enhance = compose( | ||
themeable(), | ||
onClickOutside, | ||
Radium | ||
); | ||
|
||
export default enhance(EmojiMenu); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* eslint-env mocha */ | ||
/* eslint react/jsx-filename-extension: [0] */ | ||
import React from 'react'; | ||
import chai, { expect } from 'chai'; | ||
import { shallow } from 'enzyme'; | ||
import sinon from 'sinon'; | ||
import sinonChai from 'sinon-chai'; | ||
import EventListener from 'react-event-listener'; | ||
import EmojiMenu from '../../src/emoji-menu/component'; | ||
import EmojiModifiers from '../../src/emoji-menu/emoji-modifiers'; | ||
import EmojiCategory from '../../src/emoji-menu/emoji-category'; | ||
import EmojiCategories from '../../src/emoji-menu/emoji-categories'; | ||
import getStyles from '../../src/emoji-menu/get-styles'; | ||
|
||
chai.use(sinonChai); | ||
|
||
describe('EmojiFilter', () => { | ||
const props = { | ||
style: {}, | ||
hideMenu: () => {}, | ||
sendEmoji: () => {}, | ||
color: '#1BA6C4' | ||
}; | ||
|
||
beforeEach(() => { | ||
global.navigator = { userAgent: 'all' }; | ||
}); | ||
|
||
afterEach(() => { | ||
global.navigator = undefined; | ||
}); | ||
|
||
it('should be an instanceOf AdminBadge', () => { | ||
const component = shallow(<EmojiMenu {...props} />); | ||
|
||
expect(component.instance()).to.be.instanceOf(EmojiMenu); | ||
}); | ||
|
||
it('should render root elements', () => { | ||
const component = shallow(<EmojiMenu {...props} />); | ||
|
||
expect(component.find('section')).to.have.length(0); | ||
expect(component.find(EmojiModifiers)).to.have.length(0); | ||
expect(component.find(EmojiCategory)).to.have.length(0); | ||
expect(component.find(EmojiCategories)).to.have.length(0); | ||
expect(component.find(EventListener)).to.have.length(0); | ||
|
||
component.setProps({ open: true }); | ||
expect(component.find(EmojiModifiers)).to.have.length(1); | ||
expect(component.find(EmojiCategory)).to.have.length(1); | ||
expect(component.find(EmojiCategories)).to.have.length(1); | ||
expect(component.find(EventListener)).to.have.length(1); | ||
}); | ||
|
||
it('should get root styles', () => { | ||
const spy = sinon.spy(getStyles, 'root'); | ||
const component = shallow(<EmojiMenu {...props} />); | ||
|
||
component.setProps({ open: true }); | ||
expect(spy).to.have.been.calledWith(props.style); | ||
}); | ||
}); |