Skip to content

Commit 543e4c5

Browse files
feat: Shape tests ( Fixes #11 )
1 parent f554d47 commit 543e4c5

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

Shape.tests.ps1

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
describe Shape {
2+
it 'Makes basic shapes' {
3+
"$(shape polygon 50% 50% 0% 100% 100% 100%)" |
4+
Should -Be 'polygon(50% 50%, 0% 100%, 100% 100%)'
5+
}
6+
context 'Basic Shapes' {
7+
it 'Can make circles' {
8+
"$(Shape Circle 50%)" |
9+
Should -Be 'circle(50%)'
10+
"$(Circle 50%)" |
11+
Should -Be 'circle(50%)'
12+
"$(CSS.CIRCLE 50%)" |
13+
Should -Be 'circle(50%)'
14+
}
15+
it 'Can make ellipses' {
16+
"$(Shape ellipse 25% 50%)" |
17+
Should -Be 'ellipse(25% 50%)'
18+
"$(CSS.ELLIPSE 25% 50%)" |
19+
Should -Be 'ellipse(25% 50%)'
20+
"$(ellipse 4rem 50% at right center)" |
21+
Should -Be 'ellipse(4rem 50% at right center)'
22+
}
23+
24+
it 'Can make paths' {
25+
"$(shape path m 0 0 h 100 v 100 h -100 v -100)" |
26+
Should -Be "path('m 0 0 h 100 v 100 h -100 v -100')"
27+
"$(path2d m 0 0 h 100 v 100 h -100 v -100)" |
28+
Should -Be "path('m 0 0 h 100 v 100 h -100 v -100')"
29+
"$(css.path2d m 0 0 h 100 v 100 h -100 v -100)" |
30+
Should -Be "path('m 0 0 h 100 v 100 h -100 v -100')"
31+
"$(css.path m 0 0 h 100 v 100 h -100 v -100)" |
32+
Should -Be "path('m 0 0 h 100 v 100 h -100 v -100')"
33+
}
34+
35+
it 'Can make polygons' {
36+
"$(shape polygon 50% 50% 0% 100% 100% 100%)" |
37+
Should -Be 'polygon(50% 50%, 0% 100%, 100% 100%)'
38+
"$(POLYGON 50% 50% 0% 100% 100% 100%)" |
39+
Should -Be 'polygon(50% 50%, 0% 100%, 100% 100%)'
40+
"$(css.POLYGON 50% 50% 0% 100% 100% 100%)" |
41+
Should -Be 'polygon(50% 50%, 0% 100%, 100% 100%)'
42+
}
43+
44+
it 'Can make shapes' {
45+
"$(shape nonzero from 0 0 line to 10px 10px)" |
46+
Should -Be 'shape(nonzero from 0 0, line to 10px 10px)'
47+
48+
"$(Shape 'nonzero from 0 0' 'line to 10px 10px')" |
49+
Should -Be 'shape(nonzero from 0 0, line to 10px 10px)'
50+
51+
"$(CSS.SHAPE 'nonzero from 0 0' 'line to 10px 10px')" |
52+
Should -Be 'shape(nonzero from 0 0, line to 10px 10px)'
53+
54+
"$(css.SHAPE 'nonzero from 0 0' 'line to 10px 10px')" |
55+
Should -Be 'shape(nonzero from 0 0, line to 10px 10px)'
56+
}
57+
58+
it 'Can make insets' {
59+
"$(shape inset 10% 20% 30% 40%)" |
60+
Should -Be 'inset(10% 20% 30% 40%)'
61+
"$(inset 10% 20% 30% 40%)" |
62+
Should -Be 'inset(10% 20% 30% 40%)'
63+
}
64+
65+
it 'Can make a xywh relative shape' {
66+
"$(shape xywh 10% 20% 30% 40%)" |
67+
Should -Be 'xywh(10% 20% 30% 40%)'
68+
"$(xywh 10% 20% 30% 40%)" |
69+
Should -Be 'xywh(10% 20% 30% 40%)'
70+
}
71+
72+
it 'Can make rectangles' {
73+
"$(shape Rect 0 1% auto 3% round 0 1px)" |
74+
Should -Be 'rect(0 1% auto 3% round 0 1px)'
75+
"$(rect 0 1% auto 3% round 0 1px)" |
76+
Should -Be 'rect(0 1% auto 3% round 0 1px)'
77+
"$(CSS.Rect 0 1% auto 3% round 0 1px)" |
78+
Should -Be 'rect(0 1% auto 3% round 0 1px)'
79+
}
80+
}
81+
}

0 commit comments

Comments
 (0)