UNPKG

@crossed/primitive

Version:

A universal & performant styling library for React Native, Next.js & React

31 lines (30 loc) 1.13 kB
"use strict"; var import_jsx_runtime = require("react/jsx-runtime"); var import_jest_dom = require("@testing-library/jest-dom"); var import_test = require("@crossed/test"); var import_LabelInput = require("../LabelInput"); var import_context = require("../context"); jest.mock("../context"); jest.mock("@crossed/core/src/composeRefs"); const useContextMocked = import_context.useContext; describe("createLabelMain", () => { beforeEach(() => { useContextMocked.mockImplementation(() => ({ id: "id", inputRef: { current: void 0 } })); }); afterEach(() => { useContextMocked.mockReset(); }); test("init", async () => { (0, import_test.render)( /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LabelInput.LabelInput, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { "data-testid": "input" }) }) ); expect(useContextMocked).toBeCalled(); const el = await import_test.screen.getByTestId("input"); expect(el).toHaveAttribute("id", "id"); expect(el).toHaveAttribute("aria-labelledby", "label-id"); }); }); //# sourceMappingURL=LabelInput.spec.js.map