mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
32 lines
671 B
JavaScript
32 lines
671 B
JavaScript
import React, { Component } from 'react';
|
|
import { findDOMNode } from 'react-dom';
|
|
import PropTypes from 'prop-types';
|
|
import axe from 'axe-core';
|
|
|
|
class WrapStory extends Component {
|
|
static propTypes = {
|
|
context: PropTypes.object,
|
|
storyFn: PropTypes.func,
|
|
channel: PropTypes.object,
|
|
};
|
|
|
|
componentDidMount() {
|
|
const { channel } = this.props;
|
|
const wrapper = findDOMNode(this);
|
|
|
|
if (wrapper !== null) {
|
|
axe.a11yCheck(wrapper, {}, results => {
|
|
channel.emit('addon:a11y:check', results);
|
|
});
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const { storyFn, context } = this.props;
|
|
|
|
return storyFn(context);
|
|
}
|
|
}
|
|
|
|
export default WrapStory;
|