-
Notifications
You must be signed in to change notification settings - Fork 8
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
shadcn skeleton #721
shadcn skeleton #721
Changes from 5 commits
11ac63f
369dc20
6923baf
9cfdf1c
d31871f
4752779
9f23624
69fa07a
c3e186d
ad47c5d
5980ebe
a2b4b73
a630362
2db79f8
8539128
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,26 @@ | ||
/* eslint-disable jest/valid-expect */ | ||
import React from "react"; | ||
import { PolarisAutoInput } from "../../../../src/auto/polaris/inputs/PolarisAutoInput.js"; | ||
import { makeShadcnAutoInput } from "../../../../src/auto/shadcn/inputs/ShadcnAutoInput.js"; | ||
import { humanizeCamelCase } from "../../../../src/utils.js"; | ||
import { api } from "../../../support/api.js"; | ||
import { describeForEachAutoAdapter } from "../../../support/auto.js"; | ||
|
||
import { Button } from "../../../../spec/auto/shadcn-defaults/components/Button.js"; | ||
import { Checkbox } from "../../../../spec/auto/shadcn-defaults/components/Checkbox.js"; | ||
import { Input } from "../../../../spec/auto/shadcn-defaults/components/Input.js"; | ||
import { Label } from "../../../../spec/auto/shadcn-defaults/components/Label.js"; | ||
|
||
const AutoInput = (props: { suiteName: string; field: string; label?: string }) => { | ||
if (props.suiteName === "Polaris") { | ||
return <PolarisAutoInput {...props} />; | ||
} | ||
|
||
if (props.suiteName === "Shadcn") { | ||
const ShadcnAutoInput = makeShadcnAutoInput({ Input: Input, Label: Label, Checkbox: Checkbox, Button: Button }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can you move this outside of this function? Otherwise, it's going to re-create the input component every render and for every test, which is kinda slow, and also not how production uses of this stuff will work so I think it will test it a bit differently. the factory functions should generally be invoked in the module scope |
||
return <ShadcnAutoInput {...props} />; | ||
} | ||
|
||
throw new Error("Invalid suite name"); | ||
}; | ||
|
||
|
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.
tiny nit: I think this is going to be easy to forget to fix later cause its going to show up as a green test when we look at the list of tests. can you file a github issue to ensure we come back to re-enable this?