level_0
int64
0
10k
index
int64
0
0
repo_id
stringlengths
22
152
file_path
stringlengths
41
203
content
stringlengths
11
11.5M
8,478
0
petrpan-code/shadcn-ui/ui/packages/cli/test
petrpan-code/shadcn-ui/ui/packages/cli/test/utils/transform-css-vars.test.ts
import { expect, test } from "vitest" import { transform } from "../../src/utils/transformers" import stone from "../fixtures/colors/stone.json" test("transform css vars", async () => { expect( await transform({ filename: "test.ts", raw: `import * as React from "react" export function Foo() { retur...
8,479
0
petrpan-code/shadcn-ui/ui/packages/cli/test
petrpan-code/shadcn-ui/ui/packages/cli/test/utils/transform-import.test.ts
import { expect, test } from "vitest" import { transform } from "../../src/utils/transformers" test("transform import", async () => { expect( await transform({ filename: "test.ts", raw: `import * as React from "react" import { Foo } from "bar" import { Button } from "@/registry/new-york/ui/butto...
8,480
0
petrpan-code/shadcn-ui/ui/packages/cli/test
petrpan-code/shadcn-ui/ui/packages/cli/test/utils/transform-rsc.test.ts
import { expect, test } from "vitest" import { transform } from "../../src/utils/transformers" test("transform rsc", async () => { expect( await transform({ filename: "test.ts", raw: `import * as React from "react" import { Foo } from "bar" `, config: { tsx: true, rsc: true...
8,481
0
petrpan-code/shadcn-ui/ui/packages/cli/test/utils
petrpan-code/shadcn-ui/ui/packages/cli/test/utils/__snapshots__/transform-css-vars.test.ts.snap
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`transform css vars 1`] = ` "import * as React from \\"react\\" export function Foo() { return <div className=\\"bg-background hover:bg-muted text-primary-foreground sm:focus:text-accent-foreground\\">foo</div> }\\" " `; exports[`transform css...
8,482
0
petrpan-code/shadcn-ui/ui/packages/cli/test/utils
petrpan-code/shadcn-ui/ui/packages/cli/test/utils/__snapshots__/transform-import.test.ts.snap
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`transform import 1`] = ` "import * as React from \\"react\\" import { Foo } from \\"bar\\" import { Button } from \\"@/components/ui/button\\" import { Label} from \\"ui/label\\" import { Box } from \\"@/components/box\\" import { ...
8,483
0
petrpan-code/shadcn-ui/ui/packages/cli/test/utils
petrpan-code/shadcn-ui/ui/packages/cli/test/utils/__snapshots__/transform-rsc.test.ts.snap
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`transform rsc 1`] = ` "import * as React from \\"react\\" import { Foo } from \\"bar\\" " `; exports[`transform rsc 2`] = ` "\\"use client\\" import * as React from \\"react\\" import { Foo } from \\"bar\\" " `; exports[`transform ...
8,656
0
petrpan-code/chakra-ui/chakra-ui/examples/create-react-app
petrpan-code/chakra-ui/chakra-ui/examples/create-react-app/src/App.test.tsx
import React from "react" import { render } from "@testing-library/react" import App from "./App" test("renders learn react link", () => { const { getByText } = render(<App />) const linkElement = getByText(/learn react/i) expect(linkElement).toBeInTheDocument() })
8,751
0
petrpan-code/chakra-ui/chakra-ui/packages/components/accordion
petrpan-code/chakra-ui/chakra-ui/packages/components/accordion/tests/accordion.test.tsx
import * as React from "react" import { focus, render, testA11y, screen } from "@chakra-ui/test-utils" import { Accordion, AccordionButton, AccordionItem, AccordionPanel, } from "../src" test("passes a11y test", async () => { await testA11y( <Accordion> <AccordionItem> <h2> <Accor...
8,765
0
petrpan-code/chakra-ui/chakra-ui/packages/components/alert
petrpan-code/chakra-ui/chakra-ui/packages/components/alert/tests/alert.test.tsx
import * as React from "react" import { render, testA11y, screen } from "@chakra-ui/test-utils" import { Alert, AlertDescription, AlertIcon, AlertTitle } from "../src" test("passes a11y test", async () => { await testA11y( <Alert> <AlertIcon /> <AlertTitle>Alert title</AlertTitle> <AlertDescrip...
8,788
0
petrpan-code/chakra-ui/chakra-ui/packages/components/avatar
petrpan-code/chakra-ui/chakra-ui/packages/components/avatar/tests/avatar-group.test.tsx
import * as React from "react" import { render, testA11y, screen } from "@chakra-ui/test-utils" import { Avatar, AvatarGroup } from "../src" it("passes a11y test", async () => { await testA11y( <AvatarGroup> <Avatar /> </AvatarGroup>, { axeOptions: { rules: { "svg-img-alt": ...
8,789
0
petrpan-code/chakra-ui/chakra-ui/packages/components/avatar
petrpan-code/chakra-ui/chakra-ui/packages/components/avatar/tests/avatar.test.tsx
import { mocks, render, testA11y, act } from "@chakra-ui/test-utils" import * as React from "react" import { Avatar, AvatarBadge } from "../src" describe("accessibility", () => { test("passes a11y test", async () => { await testA11y(<Avatar />, { axeOptions: { rules: { "svg-img-alt": { en...
8,803
0
petrpan-code/chakra-ui/chakra-ui/packages/components/breadcrumb
petrpan-code/chakra-ui/chakra-ui/packages/components/breadcrumb/tests/breadcrumb.test.tsx
import * as React from "react" import { render, screen, testA11y } from "@chakra-ui/test-utils" import { Breadcrumb, BreadcrumbItem, BreadcrumbLink } from "../src" it("passes a11y test", async () => { await testA11y( <Breadcrumb> <BreadcrumbItem> <BreadcrumbLink href="#">Link 1</BreadcrumbLink> ...
8,819
0
petrpan-code/chakra-ui/chakra-ui/packages/components/button
petrpan-code/chakra-ui/chakra-ui/packages/components/button/tests/button-group.test.tsx
import { render, testA11y } from "@chakra-ui/test-utils" import { Button, ButtonGroup } from "../src" it("passes a11y test", async () => { await testA11y( <ButtonGroup> <Button>Button 1</Button> <Button>Button 2</Button> <Button>Button 3</Button> <Button>Button 4</Button> </ButtonGrou...
8,820
0
petrpan-code/chakra-ui/chakra-ui/packages/components/button
petrpan-code/chakra-ui/chakra-ui/packages/components/button/tests/button.test.tsx
import * as React from "react" import { render, testA11y, screen } from "@chakra-ui/test-utils" import { EmailIcon, ArrowForwardIcon } from "@chakra-ui/icons" import { Button, ButtonGroup } from "../src" it("passes a11y test", async () => { await testA11y(<Button>test</Button>) }) test("renders with icons", () => {...
8,847
0
petrpan-code/chakra-ui/chakra-ui/packages/components/checkbox
petrpan-code/chakra-ui/chakra-ui/packages/components/checkbox/tests/checkbox.test.tsx
import { FormControl, FormLabel } from "@chakra-ui/form-control" import { Icon } from "@chakra-ui/icon" import { fireEvent, render, screen, testA11y } from "@chakra-ui/test-utils" import * as React from "react" import { Checkbox, CheckboxGroup, CheckboxGroupProps, useCheckbox, useCheckboxGroup, UseCheckboxP...
8,857
0
petrpan-code/chakra-ui/chakra-ui/packages/components/clickable
petrpan-code/chakra-ui/chakra-ui/packages/components/clickable/tests/clickable.test.tsx
import { chakra, forwardRef } from "@chakra-ui/system" import { fireEvent, render, screen } from "@chakra-ui/test-utils" import * as React from "react" import { useClickable } from "../src" const Clickable = forwardRef((props: any, ref) => { const clickable = useClickable({ ...props, ref }) as any return <chakra.b...
8,866
0
petrpan-code/chakra-ui/chakra-ui/packages/components/close-button
petrpan-code/chakra-ui/chakra-ui/packages/components/close-button/tests/close-button.test.tsx
import * as React from "react" import { render, testA11y, screen } from "@chakra-ui/test-utils" import { CloseButton } from "../src" test("passes a11y test", async () => { await testA11y(<CloseButton />) }) test("has the proper aria attributes", () => { render(<CloseButton />) expect(screen.getByLabelText("Clos...
8,884
0
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode/test/color-mode-provider.test.tsx
import { render } from "@chakra-ui/test-utils" import * as React from "react" import { ColorModeProvider, cookieStorageManager } from "../src" import { defaultThemeOptions, DummyComponent, getColorModeButton, mockCookieStorage, mockLocalStorage, mockMatchMedia, } from "./utils" describe("<ColorModeProvider...
8,885
0
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode/test/color-mode-script.test.tsx
import { getScriptSrc, ConfigColorMode, cookieStorageManager } from "../src" import { mockMatchMedia } from "./utils" describe("localStorage: color-mode-script", () => { it.each( [ { system: "light", initial: "light", expect: "light" }, { system: "dark", initial: "light", expect: "light" }, { s...
8,886
0
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode/test/dark-mode.test.tsx
import * as React from "react" import { render, screen } from "@chakra-ui/test-utils" import { DarkMode } from "../src" import { DummyComponent, getColorModeButton, MemoizedComponent, mockMatchMedia, RegularComponent, resetCounter, } from "./utils" const MemoTest = () => { const [, setRenderCount] = Reac...
8,887
0
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode/test/light-mode.test.tsx
import * as React from "react" import { render, screen } from "@chakra-ui/test-utils" import { LightMode } from "../src" import { DummyComponent, getColorModeButton, MemoizedComponent, mockMatchMedia, RegularComponent, resetCounter, } from "./utils" const MemoTest = () => { const [, setRenderCount] = Rea...
8,888
0
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode
petrpan-code/chakra-ui/chakra-ui/packages/components/color-mode/test/use-color-mode-value.test.tsx
import * as React from "react" import { render, screen } from "@chakra-ui/test-utils" import { ColorModeProvider, useColorModeValue, useColorMode } from "../src" import { defaultThemeOptions, mockMatchMedia } from "./utils" const lightValue = "light-value" const darkValue = "dark-value" function DummyComponent() { ...
8,898
0
petrpan-code/chakra-ui/chakra-ui/packages/components/control-box
petrpan-code/chakra-ui/chakra-ui/packages/components/control-box/tests/control-box.test.tsx
import { testA11y } from "@chakra-ui/test-utils" import * as React from "react" import ControlBox from "../src/control-box" it("passes a11y test", async () => { await testA11y(<ControlBox />) })
8,907
0
petrpan-code/chakra-ui/chakra-ui/packages/components/counter
petrpan-code/chakra-ui/chakra-ui/packages/components/counter/tests/use-counter.test.tsx
import { hooks } from "@chakra-ui/test-utils" import { useCounter } from "../src" test("should increment", () => { const { result } = hooks.render(() => useCounter({ defaultValue: 0 })) hooks.act(result.current.increment) expect(result.current.valueAsNumber).toBe(1) }) test("should decrement", () => { const {...
8,940
0
petrpan-code/chakra-ui/chakra-ui/packages/components/editable
petrpan-code/chakra-ui/chakra-ui/packages/components/editable/tests/editable-textarea.test.tsx
import { fireEvent, render, screen, testA11y, waitFor, } from "@chakra-ui/test-utils" import * as React from "react" import { Editable, EditablePreview, EditableTextarea } from "../src" test("matches snapshot", () => { render( <Editable defaultValue="testing"> <EditableTextarea data-testid="texta...
8,941
0
petrpan-code/chakra-ui/chakra-ui/packages/components/editable
petrpan-code/chakra-ui/chakra-ui/packages/components/editable/tests/editable.test.tsx
import { fireEvent, render, screen, testA11y, waitFor, } from "@chakra-ui/test-utils" import * as React from "react" import { Editable, EditableInput, EditablePreview } from "../src" test("matches snapshot", () => { render( <Editable defaultValue="testing"> <EditablePreview data-testid="preview" ...
8,957
0
petrpan-code/chakra-ui/chakra-ui/packages/components/focus-lock
petrpan-code/chakra-ui/chakra-ui/packages/components/focus-lock/tests/focus-lock.test.tsx
import * as React from "react" import { render, fireEvent, screen, testA11y } from "@chakra-ui/test-utils" import { FocusLock } from "../src" test("focuses an element on render", () => { const Component = () => { return ( <FocusLock> <input data-testid="input" /> <input /> <input />...
8,969
0
petrpan-code/chakra-ui/chakra-ui/packages/components/form-control
petrpan-code/chakra-ui/chakra-ui/packages/components/form-control/tests/form-control.test.tsx
import { chakra, forwardRef, PropsOf } from "@chakra-ui/system" import { fireEvent, render, screen, testA11y } from "@chakra-ui/test-utils" import * as React from "react" import { FormControl, FormControlOptions, FormErrorIcon, FormErrorMessage, FormHelperText, FormLabel, RequiredIndicator, useFormContr...
8,979
0
petrpan-code/chakra-ui/chakra-ui/packages/components/icon
petrpan-code/chakra-ui/chakra-ui/packages/components/icon/tests/create-icon.test.tsx
import * as React from "react" import { render } from "@chakra-ui/test-utils" import { createIcon } from "../src" const chakraIconPath = [ <title key="1">Chakra Logo</title>, <rect width="257" height="257" fill="url(#paint0_linear)" rx="128.5" key="2" />, <path fill="#fff" d="M69.56...
8,980
0
petrpan-code/chakra-ui/chakra-ui/packages/components/icon
petrpan-code/chakra-ui/chakra-ui/packages/components/icon/tests/icon.test.tsx
import { testA11y } from "@chakra-ui/test-utils" import * as React from "react" import { Md3DRotation } from "react-icons/md" import { Icon } from "../src" it("passes a11y test", async () => { await testA11y(<Icon />) }) it("passes a11y test given a third-party icon", async () => { await testA11y(<Icon as={Md3DRo...
9,056
0
petrpan-code/chakra-ui/chakra-ui/packages/components/image
petrpan-code/chakra-ui/chakra-ui/packages/components/image/tests/image.test.tsx
import { render, act, screen, testA11y } from "@chakra-ui/test-utils" import * as React from "react" import { Image } from "../src" const src = "https://image.xyz/source" const fallbackSrc = "https://image.xyz/placeholder" let imageOnload: any = null /** * Override Image global to save onload * setting here so tha...
9,057
0
petrpan-code/chakra-ui/chakra-ui/packages/components/image
petrpan-code/chakra-ui/chakra-ui/packages/components/image/tests/use-image.test.tsx
import { FallbackStrategy, shouldShowFallbackImage } from "../src/use-image" type Status = "loading" | "failed" | "pending" | "loaded" describe("shouldShowFallbackImage", () => { it.each<{ status: Status; strategy: FallbackStrategy; result: boolean }>([ { status: "loading", strategy: "beforeLoadOrError", result:...
9,069
0
petrpan-code/chakra-ui/chakra-ui/packages/components/input
petrpan-code/chakra-ui/chakra-ui/packages/components/input/tests/input.test.tsx
import { render, screen, testA11y } from "@chakra-ui/test-utils" import * as React from "react" import { Input, InputGroup, InputLeftElement, InputRightElement } from "../src" test("passes a11y test", async () => { await testA11y(<Input />, { axeOptions: { rules: { label: { enabled: false }, ...
9,121
0
petrpan-code/chakra-ui/chakra-ui/packages/components/layout
petrpan-code/chakra-ui/chakra-ui/packages/components/layout/tests/layout.test.tsx
import { fireEvent, render, screen, testA11y, waitFor, hooks, } from "@chakra-ui/test-utils" import * as React from "react" // import { ChakraProvider, extendTheme } from "@chakra-ui/react" import { Box, Badge, Container, Divider, Flex, Stack, useHighlight, } from "../src" describe("<Box />",...
9,130
0
petrpan-code/chakra-ui/chakra-ui/packages/components/live-region
petrpan-code/chakra-ui/chakra-ui/packages/components/live-region/tests/live-region.test.tsx
import * as React from "react" import { render } from "@chakra-ui/test-utils" import { LiveRegion, LiveRegionOptions } from ".." test("LiveRegion creates a container and has the proper aria and role attributes", () => { render(<div />) // eslint-disable-next-line no-new new LiveRegion() const region = documen...
9,149
0
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query/tests/use-breakpoint-value-ssr.test.tsx
import { ThemeProvider } from "@chakra-ui/system" import React from "react" import { renderToStaticMarkup } from "react-dom/server" import { useBreakpointValue } from "../src" import { theme } from "./test-data" beforeEach(() => { jest.resetAllMocks() }) describe("with defaultBreakpoint", () => { // NOTE: We do n...
9,150
0
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query/tests/use-breakpoint-value.test.tsx
import React from "react" import { ThemeProvider } from "@chakra-ui/system" import { render, screen } from "@chakra-ui/test-utils" import MatchMediaMock from "jest-matchmedia-mock" import { theme, queries } from "./test-data" import { useBreakpointValue } from "../src" let matchMedia: any describe("with object", () =...
9,151
0
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query/tests/use-media-query.test.ts
import { act, renderHook } from "@testing-library/react" import MatchMedia from "./matchmedia-mock-plus" import { useMediaQuery } from "../src/use-media-query" let matchMedia: MatchMedia describe("with useMediaQuery", () => { beforeAll(() => { matchMedia = new MatchMedia() window.resizeTo = function resize...
9,152
0
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query
petrpan-code/chakra-ui/chakra-ui/packages/components/media-query/tests/utils.test.ts
import { getClosestValue } from "../src/media-query.utils" test("should get the closest responsive value", () => { expect(getClosestValue({ base: "40px", md: "500px" }, "xl")).toBe("500px") expect(getClosestValue({ base: "40px", md: "500px" }, "sm")).toBe("40px") expect(getClosestValue({ base: "40px" }, "lg")).t...
9,174
0
petrpan-code/chakra-ui/chakra-ui/packages/components/menu
petrpan-code/chakra-ui/chakra-ui/packages/components/menu/tests/menu.test.tsx
import { render, testA11y, fireEvent, screen, act, waitFor, } from "@chakra-ui/test-utils" import { Portal } from "@chakra-ui/portal" import * as React from "react" import { Button } from "@chakra-ui/button" import { FaSearch, FaTruck, FaUndoAlt, FaUnlink } from "react-icons/fa" import { ChakraProvider } fr...
9,197
0
petrpan-code/chakra-ui/chakra-ui/packages/components/modal
petrpan-code/chakra-ui/chakra-ui/packages/components/modal/tests/alert-dialog.test.tsx
import * as React from "react" import { render, testA11y, screen } from "@chakra-ui/test-utils" import { AlertDialog, AlertDialogBody, AlertDialogContent, AlertDialogHeader, AlertDialogOverlay, AlertDialogFooter, } from "../src" interface BasicUsageProps { isOpen?: boolean } const BasicUsage = (props: ...
9,198
0
petrpan-code/chakra-ui/chakra-ui/packages/components/modal
petrpan-code/chakra-ui/chakra-ui/packages/components/modal/tests/drawer.test.tsx
import * as React from "react" import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerOverlay, DrawerProps, } from "../src" import { render, testA11y, screen } from "@chakra-ui/test-utils" const SimpleDrawer = (props: { placement?: DrawerProps["placement"] isOpen?: boolean }) => { const [isO...
9,199
0
petrpan-code/chakra-ui/chakra-ui/packages/components/modal
petrpan-code/chakra-ui/chakra-ui/packages/components/modal/tests/modal.test.tsx
import { fireEvent, screen, render, testA11y, waitFor, } from "@chakra-ui/test-utils" import * as React from "react" import { Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, } from "../src" test("should have no accessibility violations", async () => { ...
9,200
0
petrpan-code/chakra-ui/chakra-ui/packages/components/modal
petrpan-code/chakra-ui/chakra-ui/packages/components/modal/tests/use-modal.test.tsx
import { renderHook } from "@testing-library/react" import { hideOthers } from "aria-hidden" import { MutableRefObject } from "react" import { useAriaHidden } from "../src/use-modal" jest.mock("aria-hidden") beforeEach(() => { jest.clearAllMocks() }) describe("useAriaHidden", () => { it("should be triggered if r...
9,213
0
petrpan-code/chakra-ui/chakra-ui/packages/components/number-input
petrpan-code/chakra-ui/chakra-ui/packages/components/number-input/tests/custom-format.test.tsx
import { fireEvent, render, screen, waitFor } from "@chakra-ui/test-utils" import * as React from "react" import { NumberDecrementStepper, NumberIncrementStepper, NumberInput, NumberInputField, NumberInputProps, NumberInputStepper, } from "../src" function renderComponent(props: NumberInputProps = {}) { ...
9,214
0
petrpan-code/chakra-ui/chakra-ui/packages/components/number-input
petrpan-code/chakra-ui/chakra-ui/packages/components/number-input/tests/number-input.test.tsx
import { FormControl, FormHelperText, FormLabel } from "@chakra-ui/form-control" import { focus, testA11y, fireEvent, render, hooks, screen, waitFor, } from "@chakra-ui/test-utils" import * as React from "react" import { NumberDecrementStepper, NumberIncrementStepper, NumberInput, NumberInputField...
9,224
0
petrpan-code/chakra-ui/chakra-ui/packages/components/pin-input
petrpan-code/chakra-ui/chakra-ui/packages/components/pin-input/tests/pin-input.test.tsx
import * as React from "react" import { render, fireEvent, screen, waitFor } from "@chakra-ui/test-utils" import { usePinInput, usePinInputField, UsePinInputProps, PinInputProvider, PinInputDescendantsProvider, } from "../src" function Input(props: any) { const inputProps = usePinInputField(props) return...
9,245
0
petrpan-code/chakra-ui/chakra-ui/packages/components/popover
petrpan-code/chakra-ui/chakra-ui/packages/components/popover/tests/popover.test.tsx
import * as React from "react" import { fireEvent, render, screen, waitFor } from "@chakra-ui/test-utils" import { usePopover, UsePopoverProps } from "../src" const Component = (props: UsePopoverProps) => { const { getTriggerProps, getPopoverProps, getPopoverPositionerProps, onClose, } = usePopover...
9,267
0
petrpan-code/chakra-ui/chakra-ui/packages/components/portal
petrpan-code/chakra-ui/chakra-ui/packages/components/portal/tests/portal.test.tsx
import { render, screen } from "@testing-library/react" import * as React from "react" import { Portal, PortalManager } from "../src" test("should render portal", async () => { const { baseElement } = render( <Portal> <>This is a portal 1</> <Portal>This is a portal 2</Portal> </Portal>, ) e...
9,283
0
petrpan-code/chakra-ui/chakra-ui/packages/components/progress
petrpan-code/chakra-ui/chakra-ui/packages/components/progress/tests/Progress.test.tsx
import * as React from "react" import { render, testA11y } from "@chakra-ui/test-utils" import { Progress, CircularProgress } from "../src" test("Progress renders correctly", async () => { const { container } = render( <div> <Progress aria-label="Account Usage" colorScheme="green" s...
9,302
0
petrpan-code/chakra-ui/chakra-ui/packages/components/radio
petrpan-code/chakra-ui/chakra-ui/packages/components/radio/tests/behavior.test.tsx
import { fireEvent, render, screen } from "@chakra-ui/test-utils" import * as React from "react" import { Radio, RadioGroup } from "../src" const runTest = () => { const one = screen.getByLabelText("One") const two = screen.getByLabelText("Two") const three = screen.getByLabelText("Three") expect(one).toBeChe...
9,303
0
petrpan-code/chakra-ui/chakra-ui/packages/components/radio
petrpan-code/chakra-ui/chakra-ui/packages/components/radio/tests/radio-group.test.tsx
import { FormControl } from "@chakra-ui/form-control" import { fireEvent, render, waitFor } from "@chakra-ui/test-utils" import * as React from "react" import { Radio, useRadioGroup, UseRadioGroupProps, RadioGroup } from "../src" test("works with Radio component", () => { const Component = (props: UseRadioGroupProps...
9,304
0
petrpan-code/chakra-ui/chakra-ui/packages/components/radio
petrpan-code/chakra-ui/chakra-ui/packages/components/radio/tests/radio.test.tsx
import { FormControl, FormHelperText, FormLabel } from "@chakra-ui/form-control" import { fireEvent, render, screen } from "@chakra-ui/test-utils" import * as React from "react" import { Radio, useRadio, UseRadioProps } from "../src" test("has proper aria and data attributes", async () => { const Component = (props:...
9,321
0
petrpan-code/chakra-ui/chakra-ui/packages/components/select
petrpan-code/chakra-ui/chakra-ui/packages/components/select/tests/select.test.tsx
import * as React from "react" import { render, testA11y } from "@chakra-ui/test-utils" import { FormControl } from "@chakra-ui/form-control" // import { theme } from "@chakra-ui/theme" import { Select } from "../src" test("should pass a11y check", async () => { const { container } = render( <Select aria-label="...
9,333
0
petrpan-code/chakra-ui/chakra-ui/packages/components/skeleton
petrpan-code/chakra-ui/chakra-ui/packages/components/skeleton/tests/skeleton.test.tsx
import * as React from "react" import { render } from "@chakra-ui/test-utils" import MatchMediaMock from "jest-matchmedia-mock" import { ChakraProvider } from "@chakra-ui/provider" import { Skeleton, SkeletonText } from "../src" import { queries, theme } from "./test-data" let matchMedia: any beforeAll(() => { matc...
9,356
0
petrpan-code/chakra-ui/chakra-ui/packages/components/slider
petrpan-code/chakra-ui/chakra-ui/packages/components/slider/tests/range-slider.test.tsx
import { fireEvent, focus, render, screen, testA11y, } from "@chakra-ui/test-utils" import { RangeSlider, RangeSliderFilledTrack, RangeSliderThumb, RangeSliderTrack, } from "../src" const HorizontalSlider = () => { return ( <RangeSlider aria-label={["leftThumb", "rightThumb"]} min={...
9,357
0
petrpan-code/chakra-ui/chakra-ui/packages/components/slider
petrpan-code/chakra-ui/chakra-ui/packages/components/slider/tests/slider.test.tsx
import { ChakraProvider } from "@chakra-ui/provider" import { theme as baseTheme } from "@chakra-ui/theme" import { focus, screen, render, testA11y } from "@chakra-ui/test-utils" import * as React from "react" import styled from "@emotion/styled" import { Slider, SliderFilledTrack, SliderThumb, SliderTrack, U...
9,366
0
petrpan-code/chakra-ui/chakra-ui/packages/components/spinner
petrpan-code/chakra-ui/chakra-ui/packages/components/spinner/tests/spinner.test.tsx
import * as React from "react" import { render, testA11y } from "@chakra-ui/test-utils" import { Spinner } from "../src" test("Spinner renders correctly", async () => { const { container } = render(<Spinner />) await testA11y(container) })
9,380
0
petrpan-code/chakra-ui/chakra-ui/packages/components/stat
petrpan-code/chakra-ui/chakra-ui/packages/components/stat/tests/stat.test.tsx
import * as React from "react" import { render, testA11y } from "@chakra-ui/test-utils" import { StatGroup, Stat, StatLabel, StatNumber, StatHelpText, StatArrow, } from "../src" describe("<StatGroup />", () => { it("should renders correctly", () => { const { getByTestId } = render( <StatGroup d...
9,407
0
petrpan-code/chakra-ui/chakra-ui/packages/components/switch
petrpan-code/chakra-ui/chakra-ui/packages/components/switch/tests/switch.test.tsx
import { FormControl, FormLabel } from "@chakra-ui/form-control" import { render, fireEvent } from "@chakra-ui/test-utils" import * as React from "react" import { Switch } from "../src" test("Uncontrolled - should check and uncheck", async () => { const { container, user } = render(<Switch />) const input = contai...
9,426
0
petrpan-code/chakra-ui/chakra-ui/packages/components/table
petrpan-code/chakra-ui/chakra-ui/packages/components/table/tests/table.test.tsx
import * as React from "react" import { testA11y } from "@chakra-ui/test-utils" import { Table, TableCaption, Tbody, Td, Tfoot, Th, Thead, Tr } from "../src" describe("<Table />", () => { it("should pass a11y test", async () => { const simpleTable = ( <Table> <TableCaption>Imperial to metric conver...
9,441
0
petrpan-code/chakra-ui/chakra-ui/packages/components/tabs
petrpan-code/chakra-ui/chakra-ui/packages/components/tabs/tests/tabs.test.tsx
import { testA11y, render, screen, fireEvent } from "@chakra-ui/test-utils" import * as React from "react" import { Tab, TabList, TabPanel, TabPanels, Tabs } from "../src" test("should no accessibility issues", async () => { await testA11y( <Tabs> <TabList> <Tab>Tab 1</Tab> <Tab>Tab 2</Tab>...
9,450
0
petrpan-code/chakra-ui/chakra-ui/packages/components/tag
petrpan-code/chakra-ui/chakra-ui/packages/components/tag/tests/tag.test.tsx
import { render } from "@chakra-ui/test-utils" import * as React from "react" import { Tag, TagCloseButton, TagLabel } from "../src" test("Tag (only) renders correctly", () => { const { getByTestId } = render(<Tag data-testid="tag">A</Tag>) expect(getByTestId("tag")).toBeInTheDocument() }) test("Tag with close bu...
9,459
0
petrpan-code/chakra-ui/chakra-ui/packages/components/textarea
petrpan-code/chakra-ui/chakra-ui/packages/components/textarea/tests/text-area.test.tsx
import * as React from "react" import { render, testA11y } from "@chakra-ui/test-utils" import { Textarea } from "../src" test("Textarea renders correctly", async () => { const { container } = render( <Textarea aria-label="Enter notes" defaultValue="hello" />, ) await testA11y(container) })
9,535
0
petrpan-code/chakra-ui/chakra-ui/packages/components/theme
petrpan-code/chakra-ui/chakra-ui/packages/components/theme/tests/theme.test.ts
import { theme, ChakraTheme, isChakraTheme } from "../src" describe("Theme", () => { it("should be of type ChakraTheme", () => { // Check if default theme is of type ChakraTheme const defaultThemeIsAChakraTheme: ChakraTheme = theme expect(defaultThemeIsAChakraTheme).toBeTruthy() }) it("should be che...
9,552
0
petrpan-code/chakra-ui/chakra-ui/packages/components/toast
petrpan-code/chakra-ui/chakra-ui/packages/components/toast/test/standalone-toast.test.tsx
import * as React from "react" import { render, screen, act } from "@chakra-ui/test-utils" import { createStandaloneToast } from "../src" describe("Standalone Toast", () => { it("should render a toast correctly", async () => { const { ToastContainer, toast } = createStandaloneToast() const title = "Yay!" ...
9,553
0
petrpan-code/chakra-ui/chakra-ui/packages/components/toast
petrpan-code/chakra-ui/chakra-ui/packages/components/toast/test/use-toast.test.tsx
import React from "react" import { render, screen, waitFor } from "@chakra-ui/test-utils" import { ToastOptionProvider, ToastProvider, useToast } from "../src" describe("useToast", () => { beforeEach(async () => { const toasts = screen.queryAllByRole("listitem") await Promise.all( toasts.map((toasts) =...
9,564
0
petrpan-code/chakra-ui/chakra-ui/packages/components/tooltip
petrpan-code/chakra-ui/chakra-ui/packages/components/tooltip/tests/tooltip.test.tsx
import { act, fireEvent, render, screen, testA11y, waitFor, } from "@chakra-ui/test-utils" import * as React from "react" import { Tooltip, TooltipProps } from "../src" const buttonLabel = "Hover me" const tooltipLabel = "tooltip label" const DummyComponent = ( props: Omit<TooltipProps & { isButtonDisab...
9,582
0
petrpan-code/chakra-ui/chakra-ui/packages/components/transition
petrpan-code/chakra-ui/chakra-ui/packages/components/transition/tests/collapse.test.tsx
import { render, screen } from "@chakra-ui/test-utils" import * as React from "react" import { Collapse } from "../src" describe("<Collapse />", () => { it("should hide its children", async () => { render( <Collapse> <div data-testid="collapse-children">Test</div> </Collapse>, ) expec...
9,591
0
petrpan-code/chakra-ui/chakra-ui/packages/components/visually-hidden
petrpan-code/chakra-ui/chakra-ui/packages/components/visually-hidden/tests/visually-hidden.test.tsx
import * as React from "react" import { render, testA11y } from "@chakra-ui/test-utils" import { VisuallyHidden } from "../src" test("should render correctly", async () => { const { getByText } = render(<VisuallyHidden>Click me</VisuallyHidden>) expect(getByText(/Click me/i)).toBeInTheDocument() }) test("should ...
9,648
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/calc.test.ts
import { calc, cssVar } from "../src" describe("calc", () => { it("standard usage", () => { expect(calc("10px").add("20px").toString()).toMatchInlineSnapshot( `"calc(10px + 20px)"`, ) expect(calc("10px").add("20px", "30px").toString()).toMatchInlineSnapshot( `"calc(10px + 20px + 30px)"`, ...
9,649
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/css-rtl.test.ts
import { css } from "../src" import { createTheme } from "./theme" test("RTL: should transform logical css properties", () => { const result = css({ float: "left", marginStart: "sm", roundedStart: ["20px", "40px"], borderColor: "red", insetStart: "sm", })(createTheme("rtl")) expect(result).t...
9,650
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/css-type.test.ts
import { SystemStyleObject, StyleProps } from "../src" test("should be assignable to Chakra style props", () => { const base: StyleProps = { margin: 4, } const styles: SystemStyleObject = { ...base, isolation: "isolate", pe: "4", srOnly: true, "---test": "dfd", margin: [40, 50], ...
9,651
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/css-var-token.test.ts
import { createTheme } from "./theme" import { css } from "../src" test("should expand css var token", () => { expect( css({ "--banner-height": "sizes.sm", "--checkbox-disabled-color": "colors.pinkish", "&:disabled": { color: "var(--checkbox-disabled-color)", }, })(createTheme...
9,652
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/css-var.test.ts
import { toCSSVar } from "../src" test("should convert to css variables", () => { expect( toCSSVar({ space: { sm: "8px", md: "16px", lg: "24px", }, }), ).toMatchInlineSnapshot(` { "__breakpoints": null, "__cssMap": { "space.-lg": { "value": "-24px", "...
9,653
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/css.test.ts
import { toCSSVar } from "../src/create-theme-vars" import { css } from "../src/css" const theme = toCSSVar({ breakpoints: { sm: "40em", md: "52em", lg: "64em", xl: "80em", }, colors: { red: { 500: "#ff0000", }, primary: "tomato", secondary: "cyan", }, fontSizes: [12, 14...
9,654
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/define-vars.test.ts
import { defineCssVars } from "../src" describe("defineCssVars", () => { test("should create vars group", () => { const badge = defineCssVars("badge", ["bg", "border"]) expect(badge).toMatchInlineSnapshot(` { "bg": { "reference": "var(--badge-bg)", "variable": "--badge-bg", }, "border": { "...
9,655
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/interpolation.test.ts
import { css, toCSSVar } from "../src" test("should handle array interpolations", () => { const customBreakpoints = { sm: "40em", md: "50em", lg: "60em", xl: "70em", } // @ts-ignore const result = css({ "&": [{ bg: "red" }, { bg: "green" }] })( toCSSVar({ breakpoints: customBreakpoin...
9,656
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/parse-gradient.test.ts
import { toCSSVar } from "../src" import { parseGradient } from "../src/utils/parse-gradient" const theme = toCSSVar({ colors: { green: "#006400", red: "#800000", pink: { light: "#FFB6C1", dark: "#FF1493", }, }, }) describe("linear gradient", () => { test("should convert simple value...
9,657
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/peer.test.ts
import { SystemStyleObject, css } from "../src" import { createTheme } from "./theme" test("should be resolve peer style", () => { const styles: SystemStyleObject = { bg: "redish", _peerChecked: { bg: "pinkish", }, } expect(css(styles)(createTheme("ltr"))).toMatchInlineSnapshot(` { "[data-pe...
9,658
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/sr-only.test.ts
import { css } from "../src" import { createTheme } from "./theme" test("should process sr-only", () => { const result = css({ srOnly: true, _active: { srOnly: "focusable", }, })(createTheme("ltr")) expect(result).toMatchInlineSnapshot(` { "&:active, &[data-active]": { "clip": "auto", ...
9,659
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/style-config.test.ts
import { recipe, theme } from "./theme" test("should handle single variant", () => { expect(recipe({ theme, variant: "solid", size: ["sm", "md"] })) .toMatchInlineSnapshot(` { "@media screen and (min-width: 0px) and (max-width: 39.98em)": { "fontSize": "sm", "h": 8, "minW": 8, "px": 3, }, "...
9,660
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/text-styles.test.ts
import { toCSSVar, css } from "../src" const defaultTheme = { config: { cssVarPrefix: "chakra", }, breakpoints: { base: "0em", sm: "30em", md: "48em", lg: "62em", xl: "80em", "2xl": "96em", }, space: { px: "1px", 0.5: "0.125rem", 1: "0.25rem", 1.5: "0.375rem", ...
9,662
0
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system
petrpan-code/chakra-ui/chakra-ui/packages/core/styled-system/tests/transform-functions.test.ts
import { transformFunctions as t } from "../src/utils/transform-functions" test("should transform background image", () => { expect(t.bgImage("/testing.png")).toBe("url(/testing.png)") const linear = "linear-gradient(green, gren)" expect(t.bgImage(linear)).toBe(linear) expect(t.bgImage(undefined)).toBe(undef...
9,680
0
petrpan-code/chakra-ui/chakra-ui/packages/core/system
petrpan-code/chakra-ui/chakra-ui/packages/core/system/tests/as-prop.test.tsx
/* eslint-disable @typescript-eslint/no-unused-vars */ import * as React from "react" import { chakra, ChakraComponent } from ".." /** * These tests should fail while type checking * if the typings for `ChakraComponent` change * and create a type regression */ describe("`as` prop typings", () => { const Comp = (...
9,681
0
petrpan-code/chakra-ui/chakra-ui/packages/core/system
petrpan-code/chakra-ui/chakra-ui/packages/core/system/tests/forward-ref.test.tsx
/* eslint-disable @typescript-eslint/no-unused-vars */ import * as React from "react" import { chakra, forwardRef } from ".." /** * These tests should fail while type checking * if the typings for `ChakraComponent` change * and create a type regression */ describe("`forward-ref` prop typings", () => { it("should...
9,682
0
petrpan-code/chakra-ui/chakra-ui/packages/core/system
petrpan-code/chakra-ui/chakra-ui/packages/core/system/tests/hooks.test.ts
import { hooks } from "@chakra-ui/test-utils" import { toCSSVar, useToken } from "../src" const mockRed = { 100: "mockRed.100", 200: "mockRed.200", 300: "mockRed.300", 400: "mockRed.400", 500: "mockRed.500", } const mockBlue = { 100: "mockBlue.100", 200: "mockBlue.200", 300: "mockBlue.300", 400: "mo...
9,683
0
petrpan-code/chakra-ui/chakra-ui/packages/core/system
petrpan-code/chakra-ui/chakra-ui/packages/core/system/tests/should-forward-prop.test.ts
import { propNames } from "@chakra-ui/styled-system" import { shouldForwardProp } from "../src/should-forward-prop" describe("does not forward styled-system props", () => { test.each(propNames)("%s", (propName) => { expect(shouldForwardProp(propName.toString())).toBe(false) }) }) describe("does not forward re...
9,684
0
petrpan-code/chakra-ui/chakra-ui/packages/core/system
petrpan-code/chakra-ui/chakra-ui/packages/core/system/tests/style-config.test.tsx
import * as React from "react" import { render } from "@chakra-ui/test-utils" import { ThemeProvider, useStyleConfig } from "../src" import { createTheme } from "./theme" test("should resolve styles in theme", async () => { const Component = () => { const styles = useStyleConfig("Button", { size: "sm" }) ret...
9,685
0
petrpan-code/chakra-ui/chakra-ui/packages/core/system
petrpan-code/chakra-ui/chakra-ui/packages/core/system/tests/style-resolver.test.ts
import { toCSSVar } from "@chakra-ui/styled-system" import { theme as defaultTheme } from "@chakra-ui/theme" import { toCSSObject } from "../src/system" const theme = toCSSVar({ ...defaultTheme, layerStyles: { v1: { color: "red.300", bg: "tomato", }, }, textStyles: { caps: { textT...
9,686
0
petrpan-code/chakra-ui/chakra-ui/packages/core/system
petrpan-code/chakra-ui/chakra-ui/packages/core/system/tests/system.test.tsx
import { render } from "@chakra-ui/test-utils" import * as React from "react" import { chakra } from "../src" const consoleSpy = jest.spyOn(console, "error").mockImplementation(() => {}) test("should allow custom should forward props", () => { const Div = chakra<"div", { sample: string; isBig: string }>("div", { ...
9,829
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks/tests/use-clipboard.test.tsx
import copy from "copy-to-clipboard" import { hooks } from "@chakra-ui/test-utils" import { useClipboard } from "../src" jest.mock("copy-to-clipboard") jest.useFakeTimers() jest.spyOn(global, "setTimeout") const text = "lorem ipsum" test.each` params | expected ${100} | ${100} ${{...
9,830
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks/tests/use-const.test.tsx
import { hooks } from "@chakra-ui/test-utils" import { useConst } from "../src" type FooType = { foo: string } test("should return constant value for constant initialization", () => { const obj: FooType = { foo: "bar" } const { rerender, result } = hooks.render(() => useConst<FooType>(obj)) expect(result.curren...
9,831
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks/tests/use-controllable.test.tsx
import { render, screen, hooks } from "@chakra-ui/test-utils" import React, { useState } from "react" import { useControllableState } from "../src" test("should be uncontrolled when defaultValue is passed", () => { const { result } = hooks.render(() => useControllableState({ defaultValue: "testing" }), ) con...
9,832
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks
petrpan-code/chakra-ui/chakra-ui/packages/legacy/hooks/tests/use-outside-click.test.tsx
import { render, fireEvent } from "@chakra-ui/test-utils" import * as React from "react" import { useOutsideClick } from "../src" const OutsideClicker = ({ onOutsideClick, enabled = true, }: { listenContextMenu?: boolean enabled?: boolean onOutsideClick: () => void }) => { const ref = React.useRef<HTMLDivE...
9,865
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils/tests/array.test.ts
import { getFirstItem, getLastItem, getPrevItem, getNextItem, removeIndex, addItem, removeItem, getNextIndex, getPrevIndex, chunk, getNextItemFromSearch, isCustomBreakpoint, } from "../src" const array = [1, 2, 3, 4, 5, 6, 7, 8] describe("first or last item queries", () => { test("should get...
9,866
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils/tests/assertion.test.ts
import { isNumber, isNotNumber, isNumeric, isArray, isEmptyArray, isFunction, isDefined, isUndefined, isObject, isEmptyObject, isNull, isString, isEmpty, isNotEmptyObject, isCssVar, } from "../src" test("is number", () => { expect(isNumber(1.2)).toBeTruthy() expect(isNumber("20")).toB...
9,867
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils/tests/dom.test.ts
import { ariaAttr, dataAttr, getEventWindow, getOwnerDocument, getOwnerWindow, normalizeEventKey, } from "../src" test("should get window object", () => { expect(getOwnerWindow()).toBe(window) }) test("should return data attribute value from boolean", () => { const isActive = true expect(dataAttr(is...
9,868
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils/tests/flatten.test.ts
import { flatten } from "../src" describe("flatten", () => { it("should flatten an object", () => { const flatObject = flatten({ colors: { red: { 500: "#ff0000" } } }, 1) expect(flatObject).toMatchInlineSnapshot(` { "colors.red": { "500": "#ff0000", }, } `) }) it("should flatten an array", () =>...
9,869
0
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils
petrpan-code/chakra-ui/chakra-ui/packages/legacy/utils/tests/function.test.ts
import { runIfFn, callAllHandlers } from "../src" test("should run function if function or else return value", () => { expect(runIfFn(() => 1 + 1)).toStrictEqual(2) expect(runIfFn(2)).toStrictEqual(2) }) const event = { target: { value: 1 } } test("should call all passed functions on event triggered", () => { ...