Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions __tests__/importTests.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { describe, expect, it, vi } from "vitest";

vi.mock("react", () => ({
createElement: vi.fn(),
useRef: vi.fn(() => ({ current: null })),
useState: vi.fn((initial: unknown) => [initial, vi.fn()]),
}));

vi.mock("react/jsx-runtime", () => ({
jsx: vi.fn(),
}));
Comment thread
ty2k marked this conversation as resolved.

describe("dist entrypoint exports", () => {
it("imports the root dist module and exposes VkbReactKeyboard", async () => {
const rootModule = await import("../dist/index.js");

expect(rootModule).toHaveProperty("VkbReactKeyboard");
expect(Object.keys(rootModule).sort()).toEqual(["VkbReactKeyboard"]);
expect(typeof rootModule.VkbReactKeyboard).toBe("function");
});

it("imports the react dist module and exposes Keyboard", async () => {
const rootModule = await import("../dist/index.js");
const reactModule = await import("../dist/react/index.js");

expect(reactModule).toHaveProperty("Keyboard");
expect(Object.keys(reactModule).sort()).toEqual(["Keyboard"]);
expect(typeof reactModule.Keyboard).toBe("function");
expect(reactModule.Keyboard).toBe(rootModule.VkbReactKeyboard);
});
});
2 changes: 1 addition & 1 deletion dist/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function Keyboard({ id, rows, handlePress = () => {}, ariaLabel, ariaLabelledBy,
lastShiftOrCapsPressAtRef.current = null;
return;
}
lastShiftOrCapsPressAtRef.current = null;
lastShiftOrCapsPressAtRef.current = now;
setIsShiftMode((prev) => !prev);
};
const ariaAttributes = { role: ariaRole };
Expand Down
260 changes: 130 additions & 130 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v-k-b",
"version": "0.0.1",
"version": "0.0.2",
"description": "Virtual keyboard component library",
"keywords": [
"keyboard",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"typescript": "6.0.3",
"vitest": "4.1.6"
"vitest": "4.1.7"
},
"license": "Apache-2.0",
"author": "Tyler Krys <tylerkrys@gmail.com>",
Expand Down
Loading