diff --git a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.test.tsx b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.test.tsx index 8a7b94383913..f6c7a226c34d 100644 --- a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.test.tsx +++ b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.test.tsx @@ -284,3 +284,52 @@ test('Deleting strategy after change request is applied diffs against the snapsh await screen.findByText('Deleting strategy variants:'); await screen.findByText('snapshot_variant'); }); + +test('Adding strategy always diffs against undefined strategy', async () => { + render( + + + } + /> + , + { route: `/projects/${projectId}` }, + ); + + await screen.findByText('+ Adding strategy:'); + await screen.findByText('change_request_title'); + + const viewDiff = await screen.findByText('View Diff'); + await userEvent.hover(viewDiff); + await screen.findByText(`+ name: "flexibleRollout"`); + + await screen.findByText('Setting strategy variants to:'); + await screen.findByText('change_variant'); +}); diff --git a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.tsx b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.tsx index 47637a3aa970..79e7b7d5c769 100644 --- a/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.tsx +++ b/frontend/src/component/changeRequest/ChangeRequest/Changes/Change/StrategyChange.tsx @@ -267,6 +267,56 @@ const UpdateStrategy: FC<{ ); }; +const AddStrategy: FC<{ + change: IChangeRequestAddStrategy; + actions?: ReactNode; +}> = ({ change, actions }) => { + return ( + <> + + + + + Adding strategy: + + + + +
+ +
+
+
{actions}
+
+ + {change.payload.variants && change.payload.variants.length > 0 && ( + + + Setting strategy variants to: + + + + )} + + ); +}; + export const StrategyChange: FC<{ actions?: ReactNode; change: @@ -295,49 +345,7 @@ export const StrategyChange: FC<{ return ( <> {change.action === 'addStrategy' && ( - <> - - - - + Adding strategy: - - - - -
- -
-
-
{actions}
-
- - {change.payload.variants && - change.payload.variants.length > 0 && ( - - - Setting strategy variants to: - - - - )} - + )} {change.action === 'deleteStrategy' && (