Skip to content

Commit

Permalink
Add new files and update configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Dec 31, 2023
1 parent dd5d607 commit 026582b
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import parseHTML from '../../../../../src/parse-html'
import fs from 'fs'
import path from 'path'
import MasterCSS from '@master/css'

const html = fs.readFileSync(path.join(__dirname, './document.html'), 'utf8')
const { classes } = parseHTML(html)

it('basic', () => {
const css = new MasterCSS()
classes.forEach((eachClass) => css.add(eachClass))
const whereAndNonMediaRules = css.rules.filter(({ hasWhere, media, priority }) => hasWhere && !media && priority === -1)
for (let i = 0; i < whereAndNonMediaRules.length; i++) {
const currentRule = css.rules[i + 1]
expect(currentRule.text).toBe(whereAndNonMediaRules[i].text)
}
})

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from '../../../../../../src'
import fs from 'fs'
import path from 'path'

const html = fs.readFileSync(path.join(__dirname, './document.html'), 'utf8')
const rendered = render(html)

it('basic', () => {
expect(rendered.html).toContain('.\\{font\\:mono\\;font-feature\\:normal\\}_\\:where\\(code\\,kbd\\,samp\\)')
})
18 changes: 0 additions & 18 deletions packages/server/tests/e2e/master.co/test.ts

This file was deleted.

11 changes: 10 additions & 1 deletion packages/server/tests/entities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ it('should not encode entities', () => {
)
})

it('should decode class entities', () => {
test('>', () => {
expect(render(
`<div class="mt:0&gt;div"></div>`
).html).toEqual([
'<style id="master">.mt\\:0\\>div>div{margin-top:0rem}</style>',
`<div class="mt:0&gt;div"></div>`
].join(''))
})

test('\'', () => {
expect(render(
`<div class="font-feature:'salt'"></div>`
).html).toEqual([
`<style id="master">.font-feature\\:\\'salt\\'{font-feature-settings:'salt'}</style>`,
`<div class="font-feature:'salt'"></div>`
].join(''))
})
2 changes: 1 addition & 1 deletion website/app/[locale]/root.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function RootLayout({ children, locale, bodyClassName, styl
</>
}
</head>
<body className={clsx(bodyClassName, '{font:mono;font-feature:normal}_:where(code,kbd,samp) bg:slate-50/.2_:where(::selection) fg:neutral font-feature:"salt" font:sans overflow-x:hidden')}>
<body className={clsx(bodyClassName, '{font:mono;font-feature:normal}_:where(code,kbd,samp) bg:slate-50/.2_:where(::selection) fg:neutral font-feature:\'salt\' font:sans overflow-x:hidden')}>
<Client>{children}</Client>
</body>
</html>
Expand Down
10 changes: 5 additions & 5 deletions website/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import withBundleAnalyzer from 'websites/with-bundle-analyzer.mjs'
* @type {import('next').NextConfig}
*/
const nextConfig = {
// eslint: {
// // Warning: This allows production builds to successfully complete even if
// // your project has ESLint errors.
// ignoreDuringBuilds: true,
// },
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
experimental: {
/**
* 解決 JavaScript heap out of memory 問題
Expand Down

0 comments on commit 026582b

Please sign in to comment.