Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Apr 30, 2024
1 parent 23ebba9 commit 0501496
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/full/.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {test, expect, run, fetchHtml, page, getServerUrl, autoRetry, partRegex} from '@brillout/test-e2e'
import { test, expect, run, fetchHtml, page, getServerUrl, autoRetry, partRegex } from '@brillout/test-e2e'

runTest()

Expand Down Expand Up @@ -92,7 +92,7 @@ function testUrl({
text,
counter,
noSSR
}: {url: string; title: string; text: string; counter?: true; noSSR?: true}) {
}: { url: string; title: string; text: string; counter?: true; noSSR?: true }) {
test(url + ' (HTML)', async () => {
const html = await fetchHtml(url)
if (!noSSR) {
Expand Down Expand Up @@ -123,7 +123,7 @@ async function testCounter() {
await page.click('button')
expect(await page.textContent('button')).toContain('Counter 1')
},
{timeout: 5 * 1000}
{ timeout: 5 * 1000 }
)
}

Expand Down
4 changes: 2 additions & 2 deletions packages/vike-react/src/renderer/getHtmlTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function getHtmlTags(pageContext: PageContextServer) {
const viewportContent = getViewportContent(document.viewport)

const htmlTagAttributes = document.htmlTagAttributes ?? {}
if (!htmlTagAttributes.lang) htmlTagAttributes.lang = lang
if (!htmlTagAttributes.lang) htmlTagAttributes.lang = lang ?? 'en'
const htmlAttr = getTagAttributesString(htmlTagAttributes)
const bodyAttr = getTagAttributesString(document.bodyTagAttributes ?? {})
const rootAttr = getTagAttributesString(document.rootTagAttributes ?? {})
Expand Down Expand Up @@ -76,6 +76,6 @@ function getTagAttributesString(attributes: Record<string, string>): string {
}

function ensureIsValidAttributeName(str: string): string {
if (/^[a-Z][a-Z0-9-]*$/.test(str) || str.endsWith('-')) throw new Error(`Invalid HTML attribute name ${str}`)
if (!/^[a-z][a-z0-9\-]*$/i.test(str) || str.endsWith('-')) throw new Error(`Invalid HTML attribute name ${str}`)
return str
}
2 changes: 1 addition & 1 deletion packages/vike-react/src/types/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type Document = {
*
* @default null
*/
viewport?: 'responsive' | number | { raw: string } | null
viewport?: 'responsive' | number | { raw: string } | null

/**
*
Expand Down

0 comments on commit 0501496

Please sign in to comment.