Only display expanded content when expanded is true (https://github.com/woocommerce/woocommerce-admin/pull/7611)

* Only display expanded content when expanded is true

* Add changelogs

* Fix test
This commit is contained in:
louwie17 2021-09-03 08:20:22 -03:00 committed by GitHub
parent 4c13bca528
commit 016a355623
4 changed files with 10 additions and 4 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: Fix
Update task-item logic to only display content when expanded is true. #7611

View File

@ -705,11 +705,12 @@ describe( 'TaskDashboard and TaskList', () => {
} ) );
act( () => {
const { queryByText } = render( <TaskDashboard query={ {} } /> );
expect(
queryByText( 'This is the optional task content' )
).not.toHaveClass(
expect( queryByText( 'This task is optional' ) ).not.toHaveClass(
'woocommerce-task-list__item-expandable-content-appear'
);
expect(
queryByText( 'This is the optional task content' )
).not.toBeInTheDocument();
} );
} );

View File

@ -1,6 +1,7 @@
# Unreleased
- Adjust task-item css class to prevent css conflicts. #7593
- Update task-item logic to only display content when expanded is true. #7611
# 1.5.1

View File

@ -80,7 +80,7 @@ const OptionalExpansionWrapper: React.FC< {
expanded: boolean;
} > = ( { children, expandable, expanded } ) => {
if ( ! expandable ) {
return <>{ children }</>;
return expanded ? <>{ children }</> : null;
}
return (
<VerticalCSSTransition