diff --git a/src/internal/SwitchLabel.js b/src/internal/withSwitchLabel.js similarity index 90% rename from src/internal/SwitchLabel.js rename to src/internal/withSwitchLabel.js index 1656268f563ab9..3a4d5b418c04f7 100644 --- a/src/internal/SwitchLabel.js +++ b/src/internal/withSwitchLabel.js @@ -3,6 +3,7 @@ import React, { Component, PropTypes } from 'react'; import { createStyleSheet } from 'jss-theme-reactor'; +import createHelper from 'recompose/createHelper'; import classNames from 'classnames'; export const styleSheet = createStyleSheet('SwitchLabel', (theme) => { @@ -23,12 +24,8 @@ export const styleSheet = createStyleSheet('SwitchLabel', (theme) => { }; }); -export function withSwitchLabel(SwitchComponent) { - const switchComponentName = SwitchComponent.displayName || SwitchComponent.name; - +function withSwitchLabel(SwitchComponent) { return class SwitchLabel extends Component { - static displayName = `withSwitchLabel(${switchComponentName})`; - static propTypes = { /** * If `true`, the control will be disabled. @@ -93,3 +90,5 @@ export function withSwitchLabel(SwitchComponent) { } }; } + +export default createHelper(withSwitchLabel, 'withSwitchLabel', true, true); diff --git a/src/internal/SwitchLabel.spec.js b/src/internal/withSwitchLabel.spec.js similarity index 97% rename from src/internal/SwitchLabel.spec.js rename to src/internal/withSwitchLabel.spec.js index 111a9f0f47eb57..eb85b0a6217094 100644 --- a/src/internal/SwitchLabel.spec.js +++ b/src/internal/withSwitchLabel.spec.js @@ -5,7 +5,7 @@ import React from 'react'; import { assert } from 'chai'; import { spy } from 'sinon'; import { createShallowWithContext } from 'test/utils'; -import { withSwitchLabel, styleSheet } from './SwitchLabel'; +import withSwitchLabel, { styleSheet } from './withSwitchLabel'; describe('', () => { let shallow;