Skip to content

Commit

Permalink
feat: re-write in typescript with the latest dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbeefeater committed Jan 23, 2024
1 parent 203da85 commit 1091f8c
Show file tree
Hide file tree
Showing 84 changed files with 19,361 additions and 25,259 deletions.
9 changes: 0 additions & 9 deletions .babelrc

This file was deleted.

2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

36 changes: 0 additions & 36 deletions .eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions .storybook/addons.js

This file was deleted.

7 changes: 0 additions & 7 deletions .storybook/config.js

This file was deleted.

23 changes: 23 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { StorybookConfig } from "@storybook/react-webpack5";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-webpack5",
options: {
builder: {
useSWC: true,
},
},
},
docs: {
autodocs: "tag",
},
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
154 changes: 0 additions & 154 deletions __tests__/react-typed.test.js

This file was deleted.

61 changes: 61 additions & 0 deletions __tests__/react-typed.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import { ReactTyped } from "../src";

describe("<Typed />", () => {
it("Renders correct", () => {
render(
<ReactTyped strings={["Here you can find anything"]} typeSpeed={40} />
);
expect(screen.getByTestId("react-typed")).toBeTruthy();
});
it("Renders correct with children", () => {
render(
<ReactTyped
strings={[
"Search for products",
"Search for categories",
"Search for brands",
]}
typeSpeed={40}
backSpeed={50}
attr="placeholder"
loop
>
<input data-testid="typed-input" type="text" />
</ReactTyped>
);
expect(screen.getByTestId("react-typed")).toBeTruthy();
expect(screen.getByTestId("typed-input")).toBeTruthy();
});
it("Expect to update if props were change", () => {
const typedInstance = jest.fn();

const { rerender } = render(
<ReactTyped strings={["test1", "test2"]} typedRef={typedInstance} />
);

rerender(
<ReactTyped strings={["test1", "test3"]} typedRef={typedInstance} />
);
expect(typedInstance).toBeCalledTimes(2);
});
it("Expect to return the typed object using typedRef prop", () => {
const props = {
loop: true,
stopped: true,
strings: ["test1", "test2"],
fadeOut: false,
};
let typedInstance;
render(
<ReactTyped
{...props}
typedRef={(typed) => {
typedInstance = typed;
}}
/>
);
expect(typedInstance).not.toBeFalsy();
});
});
33 changes: 0 additions & 33 deletions dist/animatedCursor.css

This file was deleted.

Loading

0 comments on commit 1091f8c

Please sign in to comment.