mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
31 lines
632 B
JavaScript
31 lines
632 B
JavaScript
import React, { Component, PropTypes } from 'react';
|
|
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;
|
|
|
|
axe.a11yCheck(this.wrapper, {}, (results) => {
|
|
channel.emit('addon:a11y:check', results);
|
|
});
|
|
}
|
|
|
|
render() {
|
|
const { storyFn, context } = this.props;
|
|
|
|
return (<span
|
|
ref={ (container) => { this.wrapper = container; } }
|
|
>
|
|
{storyFn(context)}
|
|
</span>)
|
|
}
|
|
}
|
|
|
|
export default WrapStory;
|