-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGradient.tests.ps1
More file actions
86 lines (75 loc) · 3.44 KB
/
Gradient.tests.ps1
File metadata and controls
86 lines (75 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
describe Gradient {
it 'Generates gradients' {
$gradient = '#4488ff', '#224488' | Gradient
"$gradient" | Should -Match '^radial-gradient\([\s\S]+?\)'
}
it 'Can stack gradients by joining them with commas' {
$gradients = @(
'linear', '217deg', 'rgb(255 0 0 / 80%)', 'transparent 70.71%' | Gradient
'linear', '127deg', 'rgb(0 255 0 / 80%)', 'transparent 70.71%' | Gradient
'linear', '336deg', 'rgb(0 0 255 / 80%)', 'transparent 70.71%' | Gradient
)
$($gradients | Gradient) | Should -Match 'linear-gradient[\s\S]+?,'
}
it 'Can stack gradients' {
$gradients = @(
gradient repeating-radial @(
'circle closest-side at 0.01% 0.01%'
'color-mix(in srgb, red 50%, transparent) 1rem'
'color-mix(in srgb, green 50%, transparent) 2rem'
'color-mix(in srgb, blue 50%, transparent) 3rem'
)
gradient repeating-radial @(
'circle closest-side at 99.99% 0.01%'
'color-mix(in srgb, red 50%, transparent) 1rem'
'color-mix(in srgb, green 50%, transparent) 2rem'
'color-mix(in srgb, blue 50%, transparent) 3rem'
)
)
"$($gradients | gradient)" -match 'repeating-radial-gradient[\s\S]+?repeating-radial-gradient'
}
it 'Can stack multiple types' {
$gradients = @(
gradient repeating-radial @(
'circle closest-side at 0.01% 0.01%'
'color-mix(in srgb, red 33%, transparent) 1rem'
'color-mix(in srgb, green 33%, transparent) 2rem'
'color-mix(in srgb, blue 33%, transparent) 3rem'
)
gradient repeating-linear @(
'135deg'
'color-mix(in srgb, red 33%, transparent) 1rem'
'color-mix(in srgb, green 33%, transparent) 2rem'
'color-mix(in srgb, blue 33%, transparent) 3rem'
)
gradient repeating-conic @(
'from 180deg at 99.99% 0.01%'
'color-mix(in srgb, red 33%, transparent) 0% 1%'
'color-mix(in srgb, green 33%, transparent) 1% 2%'
'color-mix(in srgb, blue 33%, transparent) 2% 3%'
)
) | gradient
"$($gradients)" | Should -Match 'repeating-radial-gradient'
"$($gradients)" | Should -Match 'repeating-linear-gradient'
"$($gradients)" | Should -Match 'repeating-conic-gradient'
$gradients.ToString("html") > ./mutli.html
}
it 'Can be clever with ToString' {
gradient repeating-radial 'red 1rem', 'green 2rem', 'blue 3rem'
$gradient = @(
gradient repeating-radial @(
'circle closest-side at 0.01% 0.01%'
'color-mix(in srgb, red 50%, transparent) 1rem'
'color-mix(in srgb, green, transparent) 2rem'
'color-mix(in srgb, blue, transparent) 3rem'
)
gradient repeating-radial @(
'circle closest-side at 99.99% 0.01%'
'color-mix(in srgb, red 50%, transparent) 1rem'
'color-mix(in srgb, green 50%, transparent) 2rem'
'color-mix(in srgb, blue 50%, transparent) 3rem'
)
) | Gradient
$gradient.ToString("html") > ./test.html
}
}