diff --git a/test/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor_test.dart b/test/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor_test.dart index 07358d8c..5807a392 100644 --- a/test/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor_test.dart +++ b/test/dart3_suggestors/null_safety_prep/fn_prop_null_aware_call_suggestor_test.dart @@ -68,6 +68,28 @@ void main() { ''')); }); + test( + 'unless the single condition is not a null check of the function being called', + () async { + await testSuggestor( + expectedPatchCount: 0, + input: withOverReactImport(''' + final Foo = uiFunction( + (props) { + final handleClick = useCallback((e) { + if (1 > 0) { + props.onClick(e); + } + }, [props.onClick]); + + return (Dom.button()..onClick = handleClick)(); + }, + UiFactoryConfig(displayName: 'Foo'), + ); + '''), + ); + }); + test('unless there are multiple conditions', () async { await testSuggestor( expectedPatchCount: 0, @@ -119,6 +141,26 @@ void main() { ''')); }); + test( + 'unless the single condition is not a null check of the function being called', + () async { + await testSuggestor( + expectedPatchCount: 0, + input: withOverReactImport(''' + final Foo = uiFunction( + (props) { + final handleClick = useCallback((e) { + 1 > 0 && props.onClick(e); + }, [props.onClick]); + + return (Dom.button()..onClick = handleClick)(); + }, + UiFactoryConfig(displayName: 'Foo'), + ); + '''), + ); + }); + test('unless there are multiple conditions', () async { await testSuggestor( expectedPatchCount: 0,