Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TD-2946 Scene Freezes On Deleting Scenario #1012

Open
wants to merge 5 commits into
base: release/v10.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ConfirmProvider/ConfirmProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe("useConfirm", () => {
fireEvent.click(getByText("Delete"));
expect(queryByText("Remove this item?")).toBeTruthy();
fireEvent.click(getByText("Yes"));
expect(queryByText("Remove this item?")).toBeTruthy();
expect(queryByText("Remove this item?")).toBeFalsy();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this test is valid any more. Suggest removing it. It is checking that the dialog is still in the DOM even when the dialog is closed which is no longer the case.

});

test("honours default options passed to the provider", () => {
Expand Down
106 changes: 55 additions & 51 deletions src/ConfirmProvider/ConfirmationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,58 +52,62 @@ const ConfirmationDialog: React.FC<ConfirmationDialogProps> = ({
);

return (
<Dialog
fullWidth
{...dialogProps}
open={open}
onClose={onClose}
data-testid="confirm-dialog"
>
{title && (
// use the dialog title from the dialog title component
<DialogTitle onClose={onCancel} {...titleProps}>
{title}
</DialogTitle>
)}
<Divider />
{content ? (
<DialogContent sx={{ p: 2 }}>
<DialogContentText
sx={{
color: theme =>
theme.palette.mode === "light"
? "rgba(0, 0, 0, 0.8)"
: "rgba(255,255,255, 1)"
}}
<>
{open ? (
<Dialog
fullWidth
{...dialogProps}
open={true}
onClose={onClose}
data-testid="confirm-dialog"
>
{title && (
// use the dialog title from the dialog title component
<DialogTitle onClose={onCancel} {...titleProps}>
{title}
</DialogTitle>
)}
<Divider />
{content ? (
<DialogContent sx={{ p: 2 }}>
<DialogContentText
sx={{
color: theme =>
theme.palette.mode === "light"
? "rgba(0, 0, 0, 0.8)"
: "rgba(255,255,255, 1)"
}}
>
{content}
<DialogContentText />
</DialogContentText>
</DialogContent>
) : (
description && (
<DialogContent sx={{ p: 2 }}>
<DialogContentText
sx={{
color: theme =>
theme.palette.mode === "light"
? "rgba(0, 0, 0, 0.8)"
: "rgba(255,255,255, 1)"
}}
>
{description}
</DialogContentText>
</DialogContent>
)
)}
<Divider />
<DialogActions
sx={{ justifyContent: "flex-end", padding: "16px" }}
{...dialogActionsProps}
>
{content}
<DialogContentText />
</DialogContentText>
</DialogContent>
) : (
description && (
<DialogContent sx={{ p: 2 }}>
<DialogContentText
sx={{
color: theme =>
theme.palette.mode === "light"
? "rgba(0, 0, 0, 0.8)"
: "rgba(255,255,255, 1)"
}}
>
{description}
</DialogContentText>
</DialogContent>
)
)}
<Divider />
<DialogActions
sx={{ justifyContent: "flex-end", padding: "16px" }}
{...dialogActionsProps}
>
{dialogActions}
</DialogActions>
</Dialog>
{dialogActions}
</DialogActions>
</Dialog>
) : null}
</>
);
};

Expand Down
Loading