Skip to content

Commit 4e58c0a

Browse files
author
John Richard Chipps-Harding
authored
Tidy and Tests (#7)
1 parent 73d56bf commit 4e58c0a

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@phntms/css-components",
33
"description": "At its core, css-components is a simple wrapper around standard CSS. It allows you to write your CSS how you wish then compose them into a component ready to be used in React.",
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
77
"homepage": "https://github.com/phantomstudios/css-components#readme",

src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export const styled = <
9696

9797
componentProps.className = componentStyles.join(" ");
9898
styledComponent.displayName = element.toString();
99-
// console.log(componentProps);
10099
return createElement(element, componentProps);
101100
}
102101
);

test/index.test.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import { render } from "@testing-library/react";
99
import { styled } from "../src";
1010

1111
describe("Basic functionality", () => {
12-
it("it should output the correct type of DOM node", async () => {
12+
it("should return the correct type of DOM node", async () => {
1313
const Button = styled("button");
1414
const { container } = render(<Button />);
1515
expect(container.firstChild?.nodeName).toEqual("BUTTON");
1616
});
1717

18-
it("it should apply the base class", async () => {
18+
it("should apply the base class", async () => {
1919
const Button = styled("button", "root");
2020
const { container } = render(<Button />);
2121
expect(container.firstChild).toHaveClass("root");
@@ -27,7 +27,19 @@ describe("Basic functionality", () => {
2727
expect(container.firstChild).toHaveTextContent("Hello");
2828
});
2929

30-
it("should pass provide typescript support for built in types", async () => {
30+
it("should pass through multiple children", async () => {
31+
const Article = styled("article");
32+
const { container } = render(
33+
<Article>
34+
<h1>Title</h1>
35+
<p>Description</p>
36+
</Article>
37+
);
38+
expect(container.firstChild).toHaveTextContent("Title");
39+
expect(container.firstChild).toHaveTextContent("Description");
40+
});
41+
42+
it("should provide typescript support for built in types", async () => {
3143
const Input = styled("input");
3244
const onChange = jest.fn();
3345
const { container } = render(<Input value={"test"} onChange={onChange} />);

0 commit comments

Comments
 (0)