Skip to content

Commit

Permalink
Get rid of extra span
Browse files Browse the repository at this point in the history
This allows us to test against the original html structure with storyshot’s snapshot testing.
  • Loading branch information
zinserjan authored and ndelangen committed Nov 11, 2017
1 parent 7bd40cf commit 8d4f74b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions addons/a11y/src/components/WrapStory.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import { findDOMNode } from 'react-dom';
import PropTypes from 'prop-types';
import axe from 'axe-core';

Expand All @@ -11,20 +12,19 @@ class WrapStory extends Component {

componentDidMount() {
const { channel } = this.props;
const wrapper = findDOMNode(this);

axe.a11yCheck(this.wrapper, {}, (results) => {
channel.emit('addon:a11y:check', results);
});
if (wrapper !== null) {
axe.a11yCheck(wrapper, {}, (results) => {
channel.emit('addon:a11y:check', results);
});
}
}

render() {
const { storyFn, context } = this.props;

return (<span
ref={ (container) => { this.wrapper = container; } }
>
{storyFn(context)}
</span>)
return storyFn(context);
}
}

Expand Down

0 comments on commit 8d4f74b

Please sign in to comment.