1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-22 01:46:51 +01:00
This commit is contained in:
Matthias Kretschmann 2022-11-19 21:01:53 +00:00
parent 82ff684a69
commit ca151a6452
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 12 additions and 11 deletions

View File

@ -23,7 +23,9 @@ const esModules = [
'escape-string-regexp', 'escape-string-regexp',
'markdown-table', 'markdown-table',
'web-namespaces', 'web-namespaces',
'@rainbow-me/rainbowkit' '@rainbow-me/rainbowkit',
'wagmi',
'@wagmi/core'
].join('|') ].join('|')
module.exports = { module.exports = {

View File

@ -7,6 +7,8 @@ export const wrapPageElement: GatsbySSR['wrapPageElement'] =
wrapPageElementWithLayout wrapPageElementWithLayout
export const onRenderBody = ({ setPostBodyComponents, setHtmlAttributes }) => { export const onRenderBody = ({ setPostBodyComponents, setHtmlAttributes }) => {
setHtmlAttributes({ lang: 'en' })
const isEnabled = process.env.NODE_ENV === 'production' const isEnabled = process.env.NODE_ENV === 'production'
if (!isEnabled) { if (!isEnabled) {
@ -18,7 +20,6 @@ export const onRenderBody = ({ setPostBodyComponents, setHtmlAttributes }) => {
'data-website-id': UMAMI_WEBSITE_ID 'data-website-id': UMAMI_WEBSITE_ID
} }
setHtmlAttributes({ lang: 'en' })
setPostBodyComponents([ setPostBodyComponents([
<script key="umami-script" async defer {...umamiOptions} /> <script key="umami-script" async defer {...umamiOptions} />
]) ])

View File

@ -21,13 +21,11 @@ export function PureChangelog({
}): ReactElement | null { }): ReactElement | null {
const [changelogHtml, setChangelogHtml] = useState() const [changelogHtml, setChangelogHtml] = useState()
const repoFilteredArray = repos const repoMatch = repos
.map(({ node }) => { .map(({ node }) => {
if (node.name === repo) return node if (node.name === repo) return node
}) })
.filter((n: any) => n) .filter((n: any) => n)[0]
const repoMatch = repoFilteredArray[0]
useEffect(() => { useEffect(() => {
if (!(repoMatch?.object as Queries.GitHub_Blob)?.text) return if (!(repoMatch?.object as Queries.GitHub_Blob)?.text) return

View File

@ -1,12 +1,12 @@
import React from 'react' import React from 'react'
import { render, fireEvent } from '@testing-library/react' import { render, fireEvent, screen } from '@testing-library/react'
import ThemeSwitch from './ThemeSwitch' import ThemeSwitch from './ThemeSwitch'
describe('ThemeSwitch', () => { describe('ThemeSwitch', () => {
it('renders correctly', () => { it('renders correctly', async () => {
const { container } = render(<ThemeSwitch />) render(<ThemeSwitch />)
const switchContainer = container.querySelector('aside') const element = await screen.findByTitle('Toggle Dark Mode')
expect(switchContainer).toBeInTheDocument() expect(element).toBeInTheDocument()
}) })
it('checkbox can be changed', () => { it('checkbox can be changed', () => {