Skip to content

Commit

Permalink
fix: fix the previous failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed May 15, 2017
1 parent 385afe2 commit 03a8066
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/rules/void-dom-elements-no-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module.exports = {
return;
}

if (args.length < 2) {
if (args.length < 2 || args[1].type !== 'ObjectExpression') {
return;
}

Expand Down
11 changes: 4 additions & 7 deletions tests/lib/rules/void-dom-elements-no-children.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,25 @@ ruleTester.run('void-dom-elements-no-children', rule, {
'import React from "react";',
'const { createElement } = React;',
'createElement("div")'
].join('\n'),
parser: 'babel-eslint'
].join('\n')
}, {
code: [
'import React from "react";',
'const { createElement } = React;',
'createElement("img")'
].join('\n'),
parser: 'babel-eslint'
].join('\n')
}, {
code: [
'import React, {createElement, PureComponent} from \'react\';',
'class Button extends PureComponent {',
' handleClick = ev => {',
' handleClick(ev) {',
' ev.preventDefault();',
' }',
' render() {',
' return <div onClick={this.handleClick}>Hello</div>;',
' }',
'}'
].join('\n'),
parser: 'babel-eslint'
].join('\n')
}
],
invalid: [
Expand Down

0 comments on commit 03a8066

Please sign in to comment.