-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into merx-1351-fix-category-description
- Loading branch information
Showing
4 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": patch | ||
--- | ||
|
||
You can now close order manual transaction modal by clicking the close button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/orders/components/OrderManualTransactionDialog/OrderManualTransactionDialog.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { act, render, screen } from "@testing-library/react"; | ||
import userEvent from "@testing-library/user-event"; | ||
import React from "react"; | ||
|
||
import { OrderManualTransactionDialog } from "./OrderManualTransactionDialog"; | ||
|
||
jest.mock("react-intl", () => ({ | ||
useIntl: jest.fn(() => ({ | ||
formatMessage: jest.fn(x => x.defaultMessage), | ||
})), | ||
defineMessages: jest.fn(x => x), | ||
FormattedMessage: ({ defaultMessage }: { defaultMessage: string }) => <>{defaultMessage}</>, | ||
})); | ||
|
||
describe("OrderManualTransactionDialog", () => { | ||
it("should call onClose when click in close button", async () => { | ||
// Arrange | ||
const onClose = jest.fn(); | ||
|
||
render( | ||
<OrderManualTransactionDialog | ||
error={undefined} | ||
dialogProps={{ | ||
open: true, | ||
onClose, | ||
}} | ||
submitState="default" | ||
currency="USD" | ||
onAddTransaction={jest.fn()} | ||
/>, | ||
); | ||
|
||
// Act | ||
await act(async () => { | ||
await userEvent.click(screen.getByTestId("close-button")); | ||
}); | ||
|
||
// Assert | ||
expect(onClose).toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters