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

ObjectArrayControl #33

Merged
merged 21 commits into from
Mar 19, 2024
Merged

ObjectArrayControl #33

merged 21 commits into from
Mar 19, 2024

Conversation

TrangPham
Copy link
Contributor

@TrangPham TrangPham commented Mar 11, 2024

Will add tests in a separate PR

@TrangPham TrangPham changed the title WIP: ObjectArrayControl ObjectArrayControl Mar 14, 2024
@TrangPham TrangPham requested review from NathanFarmer and DrewHoo and removed request for NathanFarmer March 14, 2024 16:52
@TrangPham TrangPham marked this pull request as ready for review March 14, 2024 16:52
Copy link
Contributor

@DrewHoo DrewHoo left a comment

Choose a reason for hiding this comment

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

This needs a test--make sure to specifically test the case where multiple items exist in a list, and the first one is deleted. The bug I'm worried about is that deleting the first one just shortens the list.

import { JsonFormsDispatch } from "@jsonforms/react"
import { Flex, List, Button } from "antd"
import range from "lodash.range"
import React, { useCallback, useEffect } from "react"
Copy link
Contributor

@DrewHoo DrewHoo Mar 14, 2024

Choose a reason for hiding this comment

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

I think you can/should omit this (the React import, I mean)

src/controls/ObjectArrayControl.test.tsx Show resolved Hide resolved
})
await screen.findByDisplayValue("my asset")
await user.click(screen.getByRole("button", { name: "Add Assets" }))
const newAsset = await screen.findByDisplayValue("")
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a bit odd--maybe findByLabelText("Name")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The two inputs would have the same label though. I can update test to go from no data to some data instead

src/controls/ObjectArrayControl.test.tsx Outdated Show resolved Hide resolved
expect(updatedRemoveButtons).toHaveLength(2)
})

test("ObjectArrayControl renders with overwritten icons and does not allow overwriting onClick", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

what does overwritten icons mean, exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example:
Screenshot 2024-03-18 at 7 40 28 PM

src/stories/controls/ObjectArraryControl.stories.tsx Outdated Show resolved Hide resolved
src/stories/controls/ObjectArraryControl.stories.tsx Outdated Show resolved Hide resolved
src/stories/controls/ObjectArraryControl.stories.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,146 @@
import type { Meta, StoryObj } from "@storybook/react"

import { rendererRegistryEntries } from "../../renderers"
Copy link
Contributor

@DrewHoo DrewHoo Mar 19, 2024

Choose a reason for hiding this comment

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

this should be a merge conflict, right? Since renderers was renamed to renderer-registry-entries

src/ui-schema.ts Outdated
@@ -1,5 +1,5 @@
import type { JsonSchema } from "@jsonforms/core"
import type { AlertProps, InputNumberProps } from "antd"
import { JsonSchema } from "@jsonforms/core"
Copy link
Contributor

Choose a reason for hiding this comment

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

why kill the type imports?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. Bad rebase.

Copy link
Contributor

@DrewHoo DrewHoo left a comment

Choose a reason for hiding this comment

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

Approving but pls fix the import in the story first

@TrangPham TrangPham merged commit d5bc732 into main Mar 19, 2024
2 of 3 checks passed
@TrangPham TrangPham deleted the array-control branch March 19, 2024 19:28
Copy link

🎉 This PR is included in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants