-
Notifications
You must be signed in to change notification settings - Fork 4
Feature/add order details components #229
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5391887
chore: add table extra rows and cards components
santipalenque b3a881d
chore: add components to create OrderDetails
santipalenque 5e5c83e
v5.0.17-beta.1
santipalenque 9af165d
fix: add col count and trailing on extra rows
santipalenque 6370a03
v5.0.17-beta.2
santipalenque 76dc0d5
fix: remove unnecessary props
santipalenque 22091b5
v5.0.17-beta.3
santipalenque 705649a
v5.0.17-beta.4
santipalenque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,62 @@ | ||
| /** | ||
| * Copyright 2026 OpenStack Foundation | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * */ | ||
|
|
||
| jest.mock("i18n-react/dist/i18n-react", () => ({ | ||
| __esModule: true, | ||
| default: { translate: (key) => key } | ||
| })); | ||
|
|
||
| jest.mock("../../../utils/money", () => ({ | ||
| currencyAmountFromCents: (amount) => `$${(amount / 100).toFixed(2)}` | ||
| })); | ||
|
|
||
| import React from "react"; | ||
| import { render, screen } from "@testing-library/react"; | ||
| import "@testing-library/jest-dom"; | ||
| import FeeRow from "../table/extra-rows/FeeRow"; | ||
|
|
||
| const renderInTable = (props) => | ||
| render( | ||
| <table> | ||
| <tbody> | ||
| <FeeRow {...props} /> | ||
| </tbody> | ||
| </table> | ||
| ); | ||
|
|
||
| describe("FeeRow", () => { | ||
| test("renders nothing when fee is not provided", () => { | ||
| const { container } = renderInTable({}); | ||
| expect(container.querySelector("tr")).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the fee title", () => { | ||
| renderInTable({ fee: { title: "Processing Fee", amount: 150 } }); | ||
| expect(screen.getByText("Processing Fee")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the formatted fee amount", () => { | ||
| renderInTable({ fee: { title: "Service Fee", amount: 500 } }); | ||
| expect(screen.getByText("$5.00")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the i18n label key", () => { | ||
| renderInTable({ fee: { title: "Fee", amount: 0 } }); | ||
| expect(screen.getByText("mui_table.payfee")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders a single table row", () => { | ||
| const { container } = renderInTable({ fee: { title: "Fee", amount: 100 } }); | ||
| expect(container.querySelectorAll("tr")).toHaveLength(1); | ||
| }); | ||
| }); |
This file contains hidden or 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,68 @@ | ||
| /** | ||
| * Copyright 2026 OpenStack Foundation | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * */ | ||
|
|
||
| jest.mock("i18n-react/dist/i18n-react", () => ({ | ||
| __esModule: true, | ||
| default: { translate: (key) => key } | ||
| })); | ||
|
|
||
| jest.mock("../../../utils/money", () => ({ | ||
| currencyAmountFromCents: (amount) => `$${(amount / 100).toFixed(2)}` | ||
| })); | ||
|
|
||
| import React from "react"; | ||
| import { render, screen } from "@testing-library/react"; | ||
| import "@testing-library/jest-dom"; | ||
| import PaymentRow from "../table/extra-rows/PaymentRow"; | ||
|
|
||
| // 2026-01-15 00:00:00 UTC in seconds | ||
| const PAYMENT_TIMESTAMP = 1736899200; | ||
|
|
||
| const renderInTable = (props) => | ||
| render( | ||
| <table> | ||
| <tbody> | ||
| <PaymentRow {...props} /> | ||
| </tbody> | ||
| </table> | ||
| ); | ||
|
|
||
| describe("PaymentRow", () => { | ||
| test("renders nothing when payment is not provided", () => { | ||
| const { container } = renderInTable({}); | ||
| expect(container.querySelector("tr")).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the formatted payment amount", () => { | ||
| renderInTable({ payment: { method: "Visa", amount: 2000, created: PAYMENT_TIMESTAMP } }); | ||
| expect(screen.getByText("-$20.00")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the payment method", () => { | ||
| renderInTable({ payment: { method: "Visa", amount: 1000, created: PAYMENT_TIMESTAMP } }); | ||
| expect(screen.getByText(/Visa/)).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the i18n label keys", () => { | ||
| renderInTable({ payment: { method: "Card", amount: 500, created: PAYMENT_TIMESTAMP } }); | ||
| expect(screen.getByText("mui_table.pay")).toBeInTheDocument(); | ||
| expect(screen.getByText("mui_table.payment")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders a single table row", () => { | ||
| const { container } = renderInTable({ | ||
| payment: { method: "Card", amount: 100, created: PAYMENT_TIMESTAMP } | ||
| }); | ||
| expect(container.querySelectorAll("tr")).toHaveLength(1); | ||
| }); | ||
| }); | ||
This file contains hidden or 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,70 @@ | ||
| /** | ||
| * Copyright 2026 OpenStack Foundation | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * */ | ||
|
|
||
| jest.mock("i18n-react/dist/i18n-react", () => ({ | ||
| __esModule: true, | ||
| default: { translate: (key) => key } | ||
| })); | ||
|
|
||
| jest.mock("../../../utils/money", () => ({ | ||
| currencyAmountFromCents: (amount) => `$${(amount / 100).toFixed(2)}` | ||
| })); | ||
|
|
||
| import React from "react"; | ||
| import { render, screen } from "@testing-library/react"; | ||
| import "@testing-library/jest-dom"; | ||
| import RefundRow from "../table/extra-rows/RefundRow"; | ||
|
|
||
| const renderInTable = (props) => | ||
| render( | ||
| <table> | ||
| <tbody> | ||
| <RefundRow {...props} /> | ||
| </tbody> | ||
| </table> | ||
| ); | ||
|
|
||
| describe("RefundRow", () => { | ||
| test("renders nothing when refund is not provided", () => { | ||
| const { container } = renderInTable({}); | ||
| expect(container.querySelector("tr")).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the formatted refund amount", () => { | ||
| renderInTable({ refund: { reason: "Duplicate", status: "completed", amount: 3000 } }); | ||
| expect(screen.getByText("-$30.00")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the refund reason", () => { | ||
| renderInTable({ refund: { reason: "Customer request", status: "pending", amount: 1000 } }); | ||
| expect(screen.getByText("Customer request")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the refund status", () => { | ||
| renderInTable({ refund: { reason: "Error", status: "approved", amount: 500 } }); | ||
| expect(screen.getByText("approved")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders the i18n label keys", () => { | ||
| renderInTable({ refund: { reason: "Test", status: "pending", amount: 100 } }); | ||
| expect(screen.getByText("mui_table.ref")).toBeInTheDocument(); | ||
| expect(screen.getByText("mui_table.refund")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders a single table row", () => { | ||
| const { container } = renderInTable({ | ||
| refund: { reason: "Test", status: "pending", amount: 100 } | ||
| }); | ||
| expect(container.querySelectorAll("tr")).toHaveLength(1); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the timestamp comment to match the constant value.
1736899200is 2025-01-15 00:00:00 UTC, not 2026. The assertion logic is fine, but this comment is misleading.Suggested patch
📝 Committable suggestion
🤖 Prompt for AI Agents