diff --git a/src/components/divider/index.js b/src/components/divider/index.js
index b65687093..88336d662 100644
--- a/src/components/divider/index.js
+++ b/src/components/divider/index.js
@@ -8,7 +8,6 @@ import './index.scss'
export default class AtDivider extends AtComponent {
static defaultProps = {
- isTest: false,
content: '',
height: 112,
fontColor: '#6190E8',
@@ -38,9 +37,15 @@ export default class AtDivider extends AtComponent {
lineColor: PropTypes.string
}
+ constructor () {
+ super(...arguments)
+ if (process.env.NODE_ENV === 'test') {
+ Taro.initPxTransform({ designWidth: 750 })
+ }
+ }
+
render () {
const {
- isTest,
className,
customStyle,
content,
@@ -50,10 +55,6 @@ export default class AtDivider extends AtComponent {
lineColor
} = this.props
- if (isTest) {
- Taro.initPxTransform({ designWidth: 750 })
- }
-
const rootStyle = {
height: `${Taro.pxTransform(height)}`
}
diff --git a/src/components/divider/index.test.js b/src/components/divider/index.test.js
index 71f59ebb3..97c756187 100644
--- a/src/components/divider/index.test.js
+++ b/src/components/divider/index.test.js
@@ -5,47 +5,47 @@ import AtDivider from '../../../.temp/components/divider/index'
describe('AtDivider Snap', () => {
it('render initial AtDivider', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props customStyle', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props className', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props content', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props height', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props fontColor', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props fontSize', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props lineColor', () => {
- const component = renderToString()
+ const component = renderToString()
expect(component).toMatchSnapshot()
})
it('render AtDivider -- props childen', () => {
- const component = renderToString(test)
+ const component = renderToString(test)
expect(component).toMatchSnapshot()
})
})