Skip to content

Commit

Permalink
Added dummy tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
evankirkiles committed Jun 6, 2023
1 parent 1074dcf commit 44131f6
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 456 deletions.
9 changes: 7 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"next/core-web-vitals"
]
"plugin:react/recommended"
],
"settings": {
"react": {
"version": "detect"
}
}
}
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"printWidth": 80,
"printWidth": 120,
"trailingComma": "all",
"semi": true,
"singleQuote": true
Expand Down
2 changes: 1 addition & 1 deletion example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- <meta name="theme-color" content="#000000" /> -->
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
Expand Down
2 changes: 1 addition & 1 deletion example/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}

.ColorSection {
height: 50vh;
height: 33vh;
width: 100vw;
display: grid;
justify-content: center;
Expand Down
18 changes: 17 additions & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useMetaTheme } from 'meta-theme-swap';

function ColoredSection({ color }: { color: string }) {
const ref = useRef<HTMLDivElement>(null);
useMetaTheme(ref, color, 1, "300ms");
useMetaTheme(ref, color);
return (
<div id={color} className="ColorSection" style={{ backgroundColor: color }} ref={ref}>
{color}
Expand All @@ -21,10 +21,26 @@ function ColoredSection({ color }: { color: string }) {
function App() {
return (
<div className="App">
<ColoredSection color="#00ff00" />
<ColoredSection color="#0000ff" />
<ColoredSection color="#000000" />
<ColoredSection color="#ffff00" />
<ColoredSection color="#00ffff" />
<ColoredSection color="#ff00ff" />
<ColoredSection color="#ff0000" />
<ColoredSection color="#00ff00" />
<ColoredSection color="#0000ff" />
<ColoredSection color="#000000" />
<ColoredSection color="#ffff00" />
<ColoredSection color="#00ffff" />
<ColoredSection color="#ff00ff" />
<ColoredSection color="#ff0000" />
<ColoredSection color="#00ff00" />
<ColoredSection color="#0000ff" />
<ColoredSection color="#000000" />
<ColoredSection color="#ffff00" />
<ColoredSection color="#00ffff" />
<ColoredSection color="#ff00ff" />
</div>
);
}
Expand Down
7 changes: 4 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
roots: ["<rootDir>/src"],
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
'^.+\\.tsx?$': 'ts-jest',
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(t|j)s$',
moduleFileExtensions: ['ts', 'js', 'json', 'node'],
testRegex: '(/__tests__/.*|(\\.|/))\\.test.tsx?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/hebertcisco/ts-npm-package-boilerplate.git"
"url": "git+https://github.com/evankirkiles/meta-theme-swap.git"
},
"keywords": [
"boilerplate",
Expand All @@ -27,9 +27,9 @@
"author": "Evan Kirkiles",
"license": "MIT",
"bugs": {
"url": "https://github.com/hebertcisco/ts-npm-package-boilerplate/issues"
"url": "https://github.com/evankirkiles/meta-theme-swap/issues"
},
"homepage": "https://github.com/hebertcisco/ts-npm-package-boilerplate#readme",
"homepage": "https://github.com/evankirkiles/meta-theme-swap#readme",
"devDependencies": {
"@testing-library/react": "^14.0.0",
"@types/jest": "29.4.0",
Expand Down
Loading

0 comments on commit 44131f6

Please sign in to comment.