Skip to content

Commit 0f962ff

Browse files
committed
Refactor CSS style references in tests to use 'styles' instead of 'style' for consistency
1 parent 54e3e7e commit 0f962ff

File tree

6 files changed

+15
-9
lines changed

6 files changed

+15
-9
lines changed

packages/cli/tests/extract/watch/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ it('change config file `styles` and reset process', async () => {
9292
waitForDataMatch(child, (data) => data.includes('exported'))
9393
])
9494
const fileCSSText = fs.readFileSync(virtualCSSFilepath, { encoding: 'utf8' })
95-
expect(fileCSSText).toContain(cssEscape('bg:blue'))
95+
expect(fileCSSText).toContain('.btn{background-color:rgb(var(--blue))')
9696
}, 120000)
9797

9898
it('change html file class attr and update', async () => {

packages/cli/tests/render/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ it('render css text into <head>', async () => {
2424
<head>
2525
<link rel="styleSheet">
2626
<style></style>
27-
<style id="master">.font\\:32{font-size:2rem}.ml\\:0\\>\\:is\\(a\\,button\\)\\:first>:is(a,button):first-child{margin-left:0rem}.text\\:center{text-align:center}</style></head>
27+
<style id="master">@layer base,theme,preset,styles,general;@layer general{.font\\:32{font-size:2rem}.ml\\:0\\>\\:is\\(a\\,button\\)\\:first>:is(a,button):first-child{margin-left:0rem}.text\\:center{text-align:center}}</style></head>
2828
<body>
2929
<h1 class="text:center ml:0>:is(a,button):first font:32">Hello World</h1>
3030
</body>
@@ -53,7 +53,7 @@ it('render css text into head and create <style id="master">', async () => {
5353
<head>
5454
<link rel="styleSheet">
5555
<style></style>
56-
<style id="master">.font\\:48{font-size:3rem}.top\\:10{top:0.625rem}</style>
56+
<style id="master">@layer base,theme,preset,styles,general;@layer general{.font\\:48{font-size:3rem}.top\\:10{top:0.625rem}}</style>
5757
</head>
5858
<body>
5959
<h1 class="top:10 font:48">Hello World</h1>

packages/core/tests/config/colors/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ test.concurrent('colors', () => {
202202
expectLayers(
203203
{
204204
theme: ':root{--primary-filled:0 0 0}.light{--primary-filled:255 255 255}.dark{--primary-filled:0 0 0}',
205-
style: '.btn{background-color:rgb(var(--primary-filled))}'
205+
styles: '.btn{background-color:rgb(var(--primary-filled))}'
206206
},
207207
'btn',
208208
{

packages/core/tests/config/styles/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ import { expectLayers } from '../../test'
66
test.concurrent('styles', () => {
77
expectLayers(
88
{
9-
style: '.btn{font-size:0.875rem;height:2.5rem;text-align:center}.light .btn{background-color:rgb(0 0 0);color:rgb(255 255 255);font-weight:600}.dark .btn{background-color:rgb(255 255 255);color:rgb(255 255 255);font-weight:500}'
9+
styles: '.btn{font-size:0.875rem;height:2.5rem;text-align:center}.light .btn{background-color:rgb(0 0 0);color:rgb(255 255 255);font-weight:600}.dark .btn{background-color:rgb(255 255 255);color:rgb(255 255 255);font-weight:500}'
1010
},
1111
'btn',
1212
config
1313
)
1414

1515
expectLayers(
1616
{
17-
style: '.blue-btn{font-size:0.875rem;height:2.5rem;text-align:center}.light .blue-btn{background-color:rgb(0 0 0);color:rgb(255 255 255);font-weight:600;font-size:1.25rem}.dark .blue-btn{background-color:rgb(255 255 255);color:rgb(255 255 255);font-weight:500}'
17+
styles: '.blue-btn{font-size:0.875rem;height:2.5rem;text-align:center}.light .blue-btn{background-color:rgb(0 0 0);color:rgb(255 255 255);font-weight:600;font-size:1.25rem}.dark .blue-btn{background-color:rgb(255 255 255);color:rgb(255 255 255);font-weight:500}'
1818
},
1919
'blue-btn',
2020
config
2121
)
2222

2323
expectLayers(
2424
{
25-
style: '.blue-btn{font-size:0.875rem!important;height:2.5rem!important;text-align:center!important}.light .blue-btn{background-color:rgb(0 0 0)!important;color:rgb(255 255 255)!important;font-weight:600!important;font-size:1.25rem!important}.dark .blue-btn{background-color:rgb(255 255 255)!important;color:rgb(255 255 255)!important;font-weight:500!important}'
25+
styles: '.blue-btn{font-size:0.875rem!important;height:2.5rem!important;text-align:center!important}.light .blue-btn{background-color:rgb(0 0 0)!important;color:rgb(255 255 255)!important;font-weight:600!important;font-size:1.25rem!important}.dark .blue-btn{background-color:rgb(255 255 255)!important;color:rgb(255 255 255)!important;font-weight:500!important}'
2626
},
2727
'blue-btn',
2828
extend(config, { important: true })
@@ -31,7 +31,7 @@ test.concurrent('styles', () => {
3131
expectLayers(
3232
{
3333
theme: '.light,:root{--custom:0 0 0}.dark{--custom:255 255 255}',
34-
style: '.highlight-numbers .highlight-line:before{content:counter(lineNumber);display:inline-block;counter-increment:lineNumber;padding-right:1rem;text-align:right;margin-left:-0.3125rem;color:rgb(var(--custom));width:1.875rem;font-size:80%}'
34+
styles: '.highlight-numbers .highlight-line:before{content:counter(lineNumber);display:inline-block;counter-increment:lineNumber;padding-right:1rem;text-align:right;margin-left:-0.3125rem;color:rgb(var(--custom));width:1.875rem;font-size:80%}'
3535
},
3636
'highlight-numbers',
3737
{

packages/core/tests/contributions/jetsai.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe.concurrent('jetsai', () => {
109109

110110
expectLayers(
111111
{
112-
style: '.btn-primary{-webkit-text-fill-color:rgb(255 255 255);background-color:rgb(34 66 163)}.btn-primary:hover{background-color:rgb(21 37 89)}.btn-primary:disabled{-webkit-text-fill-color:rgb(146 151 161);background-color:rgb(205 224 247)}'
112+
styles: '.btn-primary{-webkit-text-fill-color:rgb(255 255 255);background-color:rgb(34 66 163)}.btn-primary:hover{background-color:rgb(21 37 89)}.btn-primary:disabled{-webkit-text-fill-color:rgb(146 151 161);background-color:rgb(205 224 247)}'
113113
},
114114
'btn-primary',
115115
config

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)