diff --git a/tests/lib/rules/no-children-prop.js b/tests/lib/rules/no-children-prop.js index 1288b97b14..03711835c1 100644 --- a/tests/lib/rules/no-children-prop.js +++ b/tests/lib/rules/no-children-prop.js @@ -155,6 +155,18 @@ ruleTester.run('no-children-prop', rule, { allowFunctions: true }] }, + { + code: ';', + options: [{ + allowFunctions: true + }] + }, + { + code: ';', + options: [{ + allowFunctions: true + }] + }, { code: 'React.createElement(MyComponent, {children: () => {}});', options: [{ @@ -166,6 +178,18 @@ ruleTester.run('no-children-prop', rule, { options: [{ allowFunctions: true }] + }, + { + code: 'React.createElement(MyComponent, {children: async function() {}});', + options: [{ + allowFunctions: true + }] + }, + { + code: 'React.createElement(MyComponent, {children: function* () {}});', + options: [{ + allowFunctions: true + }] } ], invalid: [ @@ -243,6 +267,20 @@ ruleTester.run('no-children-prop', rule, { }], errors: [{message: JSX_FUNCTION_ERROR}] }, + { + code: '{async function() {}};', + options: [{ + allowFunctions: true + }], + errors: [{message: JSX_FUNCTION_ERROR}] + }, + { + code: '{function* () {}};', + options: [{ + allowFunctions: true + }], + errors: [{message: JSX_FUNCTION_ERROR}] + }, { code: 'React.createElement(MyComponent, {}, () => {});', options: [{ @@ -256,6 +294,20 @@ ruleTester.run('no-children-prop', rule, { allowFunctions: true }], errors: [{message: CREATE_ELEMENT_FUNCTION_ERROR}] + }, + { + code: 'React.createElement(MyComponent, {}, async function() {});', + options: [{ + allowFunctions: true + }], + errors: [{message: CREATE_ELEMENT_FUNCTION_ERROR}] + }, + { + code: 'React.createElement(MyComponent, {}, function* () {});', + options: [{ + allowFunctions: true + }], + errors: [{message: CREATE_ELEMENT_FUNCTION_ERROR}] } ] });