[web] Update ContentLoader class name.

This commit is contained in:
Matthew Shao 2017-06-12 08:41:40 +08:00
parent d1a40def20
commit 49a04e37c3
2 changed files with 90 additions and 89 deletions

View File

@ -1,12 +1,11 @@
import React from 'react' import React from 'react'
import renderer from 'react-test-renderer' import renderer from 'react-test-renderer'
import ContentLoaderGenerator from '../../../components/ContentView/ContentLoader' import withContentLoader from '../../../components/ContentView/ContentLoader'
import { TFlow } from '../../ducks/tutils' import { TFlow } from '../../ducks/tutils'
import TestUtils from 'react-dom/test-utils' import TestUtils from 'react-dom/test-utils'
import mockXMLHttpRequest from 'mock-xmlhttprequest' import mockXMLHttpRequest from 'mock-xmlhttprequest'
global.XMLHttpRequest = mockXMLHttpRequest global.XMLHttpRequest = mockXMLHttpRequest
class tComponent extends React.Component { class tComponent extends React.Component {
constructor(props, context){ constructor(props, context){
super(props, context) super(props, context)
@ -17,7 +16,7 @@ class tComponent extends React.Component {
} }
let tflow = new TFlow(), let tflow = new TFlow(),
ContentLoader = ContentLoaderGenerator(tComponent) ContentLoader = withContentLoader(tComponent)
describe('ContentLoader Component', () => { describe('ContentLoader Component', () => {
it('should render correctly', () => { it('should render correctly', () => {

View File

@ -2,8 +2,9 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { MessageUtils } from '../../flow/utils.js' import { MessageUtils } from '../../flow/utils.js'
export default View => class extends React.Component { export default function withContentLoader(View) {
return class extends React.Component {
static displayName = View.displayName || View.name static displayName = View.displayName || View.name
static matches = View.matches static matches = View.matches
@ -96,4 +97,5 @@ export default View => class extends React.Component {
</div> </div>
) )
} }
}
}; };