[web] Minor fix and Coverage ++

This commit is contained in:
Matthew Shao 2017-06-26 09:46:29 +08:00
parent d2fa4d8341
commit 9ff29cdb2b
3 changed files with 8 additions and 7 deletions

View File

@ -11,6 +11,7 @@ describe('ContentView Component', () => {
let store = TStore()
it('should render correctly', () => {
store.getState().ui.flow.contentView = 'Edit'
let tflow = TFlow(),
provider = renderer.create(
<Provider store={store}>

View File

@ -3,7 +3,7 @@ jest.mock('../../components/EventLog/EventList')
import React from 'react'
import renderer from 'react-test-renderer'
import TestUtils from 'react-dom/test-utils'
import ConnectedComponent, { EventLog } from '../../components/EventLog'
import EventLog, { PureEventLog } from '../../components/EventLog'
import { Provider } from 'react-redux'
import { TStore } from '../ducks/tutils'
@ -14,7 +14,7 @@ describe('EventLog Component', () => {
let store = TStore(),
provider = renderer.create(
<Provider store={store}>
<ConnectedComponent/>
<EventLog/>
</Provider>),
tree = provider.toJSON()
@ -22,14 +22,14 @@ describe('EventLog Component', () => {
expect(tree).toMatchSnapshot()
})
it('should handl toggleFilter', () => {
it('should handle toggleFilter', () => {
let debugToggleButton = tree.children[0].children[1].children[0]
debugToggleButton.props.onClick()
})
provider = TestUtils.renderIntoDocument(
<Provider store={store}><ConnectedComponent/></Provider>)
let eventLog = TestUtils.findRenderedComponentWithType(provider, EventLog),
<Provider store={store}><EventLog/></Provider>)
let eventLog = TestUtils.findRenderedComponentWithType(provider, PureEventLog),
mockEvent = { preventDefault: jest.fn() }
it('should handle DragStart', () => {

View File

@ -5,7 +5,7 @@ import { toggleFilter, toggleVisibility } from '../ducks/eventLog'
import ToggleButton from './common/ToggleButton'
import EventList from './EventLog/EventList'
export class EventLog extends Component {
export class PureEventLog extends Component {
static propTypes = {
filters: PropTypes.object.isRequired,
@ -77,4 +77,4 @@ export default connect(
close: toggleVisibility,
toggleFilter: toggleFilter,
}
)(EventLog)
)(PureEventLog)