Skip to content

Commit cbe52f8

Browse files
committed
more tests
1 parent 99ad003 commit cbe52f8

3 files changed

Lines changed: 140 additions & 70 deletions

File tree

plugins/postcss-random-function/test/basic.css

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,23 @@
5050
border-bottom-left-radius: random(--foo, 0px, 10px);
5151
}
5252

53+
.random-15-b {
54+
padding: random(fixed 0.5, 0px, 10px) random(fixed 0.5, 0px, 10px);
55+
margin: random(0px, 10px) random(0px, 10px);
56+
inset: random(--foo, 0px, 10px) random(--foo, 0px, 10px);
57+
border-top-right-radius: random(0px, 10px);
58+
border-top-left-radius: random(0px, 10px);
59+
border-bottom-right-radius: random(--foo, 0px, 10px);
60+
border-bottom-left-radius: random(--foo, 0px, 10px);
61+
}
62+
5363
.random-16 {
5464
margin: random(element-shared, 0px, 10px) random(element-shared, 0px, 10px);
55-
inset: random(--foo element-shared, 0px, 10px) random(--foo element-shared, 0px, 10px);
56-
border-top-right-radius: random(element-shared, 0px, 10px);
57-
border-top-left-radius: random(element-shared, 0px, 10px);
58-
border-bottom-right-radius: random(--foo element-shared, 0px, 10px);
59-
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
65+
inset: random(--foo element-shared, 0px, 10px) random(--foo element-shared, 0px, 10px);
66+
border-top-right-radius: random(element-shared, 0px, 10px);
67+
border-top-left-radius: random(element-shared, 0px, 10px);
68+
border-bottom-right-radius: random(--foo element-shared, 0px, 10px);
69+
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
6070
}
6171

6272
.random-16 {
@@ -68,6 +78,15 @@
6878
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
6979
}
7080

81+
.random-16-b {
82+
margin: random(element-shared, 0px, 10px) random(element-shared, 0px, 10px);
83+
inset: random(--foo element-shared, 0px, 10px) random(--foo element-shared, 0px, 10px);
84+
border-top-right-radius: random(element-shared, 0px, 10px);
85+
border-top-left-radius: random(element-shared, 0px, 10px);
86+
border-bottom-right-radius: random(--foo element-shared, 0px, 10px);
87+
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
88+
}
89+
7190
.ignore-1 {
7291
--foo: 10px;
7392
width: random(0px, var(--foo));

plugins/postcss-random-function/test/basic.expect.css

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,90 @@
11
.random-1 {
2-
z-index: 9.8248;
2+
z-index: 5.21287;
33
}
44

55
.random-2 {
66
z-index: random(0, 10 1);
77
}
88

99
.random-3 {
10-
z-index: 1.06824;
10+
z-index: 9.78963;
1111
}
1212

1313
.random-4 {
14-
z-index: 8.5605;
14+
z-index: 1.76681;
1515
}
1616

1717
.random-11 {
18-
width: 3.66757px;
18+
width: 3.73222px;
1919
}
2020

2121
.random-12 {
2222
width: random(0px, 10px 1px);
2323
}
2424

2525
.random-13 {
26-
width: 2.26706px;
26+
width: 5.98171px;
2727
}
2828

2929
.random-14 {
30-
width: 1.68808px;
30+
width: 6.22777px;
3131
}
3232

3333
.random-15 {
3434
padding: 5px 5px;
35-
margin: 2.11943px 9.43757px;
36-
inset: 2.55336px 2.55336px;
37-
border-top-right-radius: 1.58971px;
38-
border-top-left-radius: 2.13428px;
39-
border-bottom-right-radius: 2.55336px;
40-
border-bottom-left-radius: 2.55336px;
35+
margin: 1.63012px 5.06483px;
36+
inset: 7.06555px 7.06555px;
37+
border-top-right-radius: 5.28165px;
38+
border-top-left-radius: 5.16324px;
39+
border-bottom-right-radius: 7.06555px;
40+
border-bottom-left-radius: 7.06555px;
4141
}
4242

4343
.random-15 {
4444
padding: 5px 5px;
45-
margin: 2.11943px 9.43757px;
46-
inset: 2.55336px 2.55336px;
47-
border-top-right-radius: 1.58971px;
48-
border-top-left-radius: 2.13428px;
49-
border-bottom-right-radius: 2.55336px;
50-
border-bottom-left-radius: 2.55336px;
45+
margin: 1.63012px 5.06483px;
46+
inset: 7.06555px 7.06555px;
47+
border-top-right-radius: 5.28165px;
48+
border-top-left-radius: 5.16324px;
49+
border-bottom-right-radius: 7.06555px;
50+
border-bottom-left-radius: 7.06555px;
51+
}
52+
53+
.random-15-b {
54+
padding: 5px 5px;
55+
margin: 7.47638px 7.02446px;
56+
inset: 8.49751px 8.49751px;
57+
border-top-right-radius: 8.99482px;
58+
border-top-left-radius: 7.27335px;
59+
border-bottom-right-radius: 8.49751px;
60+
border-bottom-left-radius: 8.49751px;
5161
}
5262

5363
.random-16 {
54-
margin: 8.54532px 1.40194px;
55-
inset: 5.77292px 5.77292px;
56-
border-top-right-radius: 7.97682px;
57-
border-top-left-radius: 5.8867px;
58-
border-bottom-right-radius: 5.77292px;
59-
border-bottom-left-radius: 5.77292px;
64+
margin: 8.81978px 3.54399px;
65+
inset: 7.51683px 7.51683px;
66+
border-top-right-radius: 5.60447px;
67+
border-top-left-radius: 9.87151px;
68+
border-bottom-right-radius: 7.51683px;
69+
border-bottom-left-radius: 7.51683px;
6070
}
6171

6272
.random-16 {
63-
margin: 8.54532px 1.40194px;
64-
inset: 5.77292px 5.77292px;
65-
border-top-right-radius: 7.97682px;
66-
border-top-left-radius: 5.8867px;
67-
border-bottom-right-radius: 5.77292px;
68-
border-bottom-left-radius: 5.77292px;
73+
margin: 8.81978px 3.54399px;
74+
inset: 7.51683px 7.51683px;
75+
border-top-right-radius: 5.60447px;
76+
border-top-left-radius: 9.87151px;
77+
border-bottom-right-radius: 7.51683px;
78+
border-bottom-left-radius: 7.51683px;
79+
}
80+
81+
.random-16-b {
82+
margin: 8.81978px 3.54399px;
83+
inset: 7.51683px 7.51683px;
84+
border-top-right-radius: 5.60447px;
85+
border-top-left-radius: 9.87151px;
86+
border-bottom-right-radius: 7.51683px;
87+
border-bottom-left-radius: 7.51683px;
6988
}
7089

7190
.ignore-1 {

plugins/postcss-random-function/test/basic.preserve-true.expect.css

Lines changed: 67 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.random-1 {
2-
z-index: 9.8248;
2+
z-index: 5.21287;
33
z-index: random(0, 10);
44
}
55

@@ -8,17 +8,17 @@
88
}
99

1010
.random-3 {
11-
z-index: 1.06824;
11+
z-index: 9.78963;
1212
z-index: random(--foo, 0, 10);
1313
}
1414

1515
.random-4 {
16-
z-index: 8.5605;
16+
z-index: 1.76681;
1717
z-index: random(--bar, 0, 10);
1818
}
1919

2020
.random-11 {
21-
width: 3.66757px;
21+
width: 3.73222px;
2222
width: random(0px, 10px);
2323
}
2424

@@ -27,76 +27,108 @@
2727
}
2828

2929
.random-13 {
30-
width: 2.26706px;
30+
width: 5.98171px;
3131
width: random(--foo, 0px, 10px);
3232
}
3333

3434
.random-14 {
35-
width: 1.68808px;
35+
width: 6.22777px;
3636
width: random(--bar, 0px, 10px);
3737
}
3838

3939
.random-15 {
4040
padding: 5px 5px;
4141
padding: random(fixed 0.5, 0px, 10px) random(fixed 0.5, 0px, 10px);
42-
margin: 2.11943px 9.43757px;
42+
margin: 1.63012px 5.06483px;
4343
margin: random(0px, 10px) random(0px, 10px);
44-
inset: 2.55336px 2.55336px;
44+
inset: 7.06555px 7.06555px;
4545
inset: random(--foo, 0px, 10px) random(--foo, 0px, 10px);
46-
border-top-right-radius: 1.58971px;
46+
border-top-right-radius: 5.28165px;
4747
border-top-right-radius: random(0px, 10px);
48-
border-top-left-radius: 2.13428px;
48+
border-top-left-radius: 5.16324px;
4949
border-top-left-radius: random(0px, 10px);
50-
border-bottom-right-radius: 2.55336px;
50+
border-bottom-right-radius: 7.06555px;
5151
border-bottom-right-radius: random(--foo, 0px, 10px);
52-
border-bottom-left-radius: 2.55336px;
52+
border-bottom-left-radius: 7.06555px;
5353
border-bottom-left-radius: random(--foo, 0px, 10px);
5454
}
5555

5656
.random-15 {
5757
padding: 5px 5px;
5858
padding: random(fixed 0.5, 0px, 10px) random(fixed 0.5, 0px, 10px);
59-
margin: 2.11943px 9.43757px;
59+
margin: 1.63012px 5.06483px;
6060
margin: random(0px, 10px) random(0px, 10px);
61-
inset: 2.55336px 2.55336px;
61+
inset: 7.06555px 7.06555px;
6262
inset: random(--foo, 0px, 10px) random(--foo, 0px, 10px);
63-
border-top-right-radius: 1.58971px;
63+
border-top-right-radius: 5.28165px;
6464
border-top-right-radius: random(0px, 10px);
65-
border-top-left-radius: 2.13428px;
65+
border-top-left-radius: 5.16324px;
6666
border-top-left-radius: random(0px, 10px);
67-
border-bottom-right-radius: 2.55336px;
67+
border-bottom-right-radius: 7.06555px;
6868
border-bottom-right-radius: random(--foo, 0px, 10px);
69-
border-bottom-left-radius: 2.55336px;
69+
border-bottom-left-radius: 7.06555px;
70+
border-bottom-left-radius: random(--foo, 0px, 10px);
71+
}
72+
73+
.random-15-b {
74+
padding: 5px 5px;
75+
padding: random(fixed 0.5, 0px, 10px) random(fixed 0.5, 0px, 10px);
76+
margin: 7.47638px 7.02446px;
77+
margin: random(0px, 10px) random(0px, 10px);
78+
inset: 8.49751px 8.49751px;
79+
inset: random(--foo, 0px, 10px) random(--foo, 0px, 10px);
80+
border-top-right-radius: 8.99482px;
81+
border-top-right-radius: random(0px, 10px);
82+
border-top-left-radius: 7.27335px;
83+
border-top-left-radius: random(0px, 10px);
84+
border-bottom-right-radius: 8.49751px;
85+
border-bottom-right-radius: random(--foo, 0px, 10px);
86+
border-bottom-left-radius: 8.49751px;
7087
border-bottom-left-radius: random(--foo, 0px, 10px);
7188
}
7289

7390
.random-16 {
74-
margin: 8.54532px 1.40194px;
91+
margin: 8.81978px 3.54399px;
7592
margin: random(element-shared, 0px, 10px) random(element-shared, 0px, 10px);
76-
inset: 5.77292px 5.77292px;
77-
inset: random(--foo element-shared, 0px, 10px) random(--foo element-shared, 0px, 10px);
78-
border-top-right-radius: 7.97682px;
79-
border-top-right-radius: random(element-shared, 0px, 10px);
80-
border-top-left-radius: 5.8867px;
81-
border-top-left-radius: random(element-shared, 0px, 10px);
82-
border-bottom-right-radius: 5.77292px;
83-
border-bottom-right-radius: random(--foo element-shared, 0px, 10px);
84-
border-bottom-left-radius: 5.77292px;
85-
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
93+
inset: 7.51683px 7.51683px;
94+
inset: random(--foo element-shared, 0px, 10px) random(--foo element-shared, 0px, 10px);
95+
border-top-right-radius: 5.60447px;
96+
border-top-right-radius: random(element-shared, 0px, 10px);
97+
border-top-left-radius: 9.87151px;
98+
border-top-left-radius: random(element-shared, 0px, 10px);
99+
border-bottom-right-radius: 7.51683px;
100+
border-bottom-right-radius: random(--foo element-shared, 0px, 10px);
101+
border-bottom-left-radius: 7.51683px;
102+
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
86103
}
87104

88105
.random-16 {
89-
margin: 8.54532px 1.40194px;
106+
margin: 8.81978px 3.54399px;
107+
margin: random(element-shared, 0px, 10px) random(element-shared, 0px, 10px);
108+
inset: 7.51683px 7.51683px;
109+
inset: random(--foo element-shared, 0px, 10px) random(--foo element-shared, 0px, 10px);
110+
border-top-right-radius: 5.60447px;
111+
border-top-right-radius: random(element-shared, 0px, 10px);
112+
border-top-left-radius: 9.87151px;
113+
border-top-left-radius: random(element-shared, 0px, 10px);
114+
border-bottom-right-radius: 7.51683px;
115+
border-bottom-right-radius: random(--foo element-shared, 0px, 10px);
116+
border-bottom-left-radius: 7.51683px;
117+
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
118+
}
119+
120+
.random-16-b {
121+
margin: 8.81978px 3.54399px;
90122
margin: random(element-shared, 0px, 10px) random(element-shared, 0px, 10px);
91-
inset: 5.77292px 5.77292px;
123+
inset: 7.51683px 7.51683px;
92124
inset: random(--foo element-shared, 0px, 10px) random(--foo element-shared, 0px, 10px);
93-
border-top-right-radius: 7.97682px;
125+
border-top-right-radius: 5.60447px;
94126
border-top-right-radius: random(element-shared, 0px, 10px);
95-
border-top-left-radius: 5.8867px;
127+
border-top-left-radius: 9.87151px;
96128
border-top-left-radius: random(element-shared, 0px, 10px);
97-
border-bottom-right-radius: 5.77292px;
129+
border-bottom-right-radius: 7.51683px;
98130
border-bottom-right-radius: random(--foo element-shared, 0px, 10px);
99-
border-bottom-left-radius: 5.77292px;
131+
border-bottom-left-radius: 7.51683px;
100132
border-bottom-left-radius: random(--foo element-shared, 0px, 10px);
101133
}
102134

0 commit comments

Comments
 (0)