@@ -13,10 +13,10 @@ export default class A11y {
1313 */
1414 constructor ( ...args ) {
1515 const {
16- React
17- , ReactDOM
18- , ...options
19- } = validate ( ...args ) ;
16+ React,
17+ ReactDOM,
18+ ...options
19+ } = validate ( ...args ) ;
2020
2121 this . options = options ;
2222 this . React = React ;
@@ -34,7 +34,7 @@ export default class A11y {
3434 // save old createElement
3535 this . _createElement = this . React . createElement ;
3636
37- const that = this ;
37+ const _this = this ;
3838 this . React . createElement = function ( klass , _props = { } , ...children ) {
3939 // fix for props = null
4040 const props = _props || { } ;
@@ -56,16 +56,16 @@ export default class A11y {
5656
5757 const newProps = typeof klass === 'string' ? { ...props , ref } : props ;
5858
59- const reactEl = that . _createElement ( klass , newProps , ...children ) ;
59+ const reactEl = _this . _createElement ( klass , newProps , ...children ) ;
6060
6161 // only test html elements
6262 if ( typeof klass === 'string' ) {
63- const handler = that . failureHandler ( reactEl , refs ) ;
63+ const handler = _this . failureHandler ( reactEl , refs ) ;
6464 const childrenForTest = children . length === 0
6565 ? props . children || [ ]
6666 : children ;
6767
68- that . suite . test ( klass , props , childrenForTest , handler ) ;
68+ _this . suite . test ( klass , props , childrenForTest , handler ) ;
6969 }
7070
7171 return reactEl ;
@@ -122,14 +122,16 @@ export default class A11y {
122122 // TODO: reduce the number of case where ther is no instance
123123 // by forcing every component to have one.
124124 if ( browser && ! this . __sync && owner && owner . _instance ) {
125+ const _this = this ;
125126 const instance = owner . _instance ;
127+
126128 // Cannot log a node reference until the component is in the DOM,
127129 // so defer the call until componentDidMount or componentDidUpdate.
128130 after . render ( instance , ( ) => {
129131 // unpack the ref
130132 let DOMNode = false ;
131133 if ( typeof ref === 'string' ) {
132- DOMNode = this . ReactDOM . findDOMNode ( instance . refs [ ref ] ) ; // TODO: replace use of findDOMNode
134+ DOMNode = _this . ReactDOM . findDOMNode ( instance . refs [ ref ] ) ; // TODO: replace use of findDOMNode
133135 } else if ( 'node' in ref ) {
134136 DOMNode = ref . node ;
135137 } else {
0 commit comments