@@ -2,130 +2,128 @@ package tailwind
22
33import (
44 "testing"
5-
6- "github.com/flanksource/maroto/v2/pkg/consts/align"
75)
86
97func TestParseAlignment (t * testing.T ) {
108 tests := []struct {
119 name string
1210 input string
13- expectedHoriz align. Type
11+ expectedHoriz Alignment
1412 expectedVert VerticalAlign
1513 }{
1614 // Basic horizontal alignments
1715 {
1816 name : "text-left" ,
1917 input : "text-left" ,
20- expectedHoriz : align . Left ,
18+ expectedHoriz : Left ,
2119 expectedVert : VerticalMiddle ,
2220 },
2321 {
2422 name : "text-center" ,
2523 input : "text-center" ,
26- expectedHoriz : align . Center ,
24+ expectedHoriz : Center ,
2725 expectedVert : VerticalMiddle ,
2826 },
2927 {
3028 name : "text-right" ,
3129 input : "text-right" ,
32- expectedHoriz : align . Right ,
30+ expectedHoriz : Right ,
3331 expectedVert : VerticalMiddle ,
3432 },
3533 {
3634 name : "text-justify" ,
3735 input : "text-justify" ,
38- expectedHoriz : align . Justify ,
36+ expectedHoriz : Justify ,
3937 expectedVert : VerticalMiddle ,
4038 },
4139
4240 // Basic vertical alignments
4341 {
4442 name : "align-top" ,
4543 input : "align-top" ,
46- expectedHoriz : align . Left ,
44+ expectedHoriz : Left ,
4745 expectedVert : VerticalTop ,
4846 },
4947 {
5048 name : "align-middle" ,
5149 input : "align-middle" ,
52- expectedHoriz : align . Left ,
50+ expectedHoriz : Left ,
5351 expectedVert : VerticalMiddle ,
5452 },
5553 {
5654 name : "align-bottom" ,
5755 input : "align-bottom" ,
58- expectedHoriz : align . Left ,
56+ expectedHoriz : Left ,
5957 expectedVert : VerticalBottom ,
6058 },
6159
6260 // Extended syntax combinations
6361 {
6462 name : "text-left-top" ,
6563 input : "text-left-top" ,
66- expectedHoriz : align . Left ,
64+ expectedHoriz : Left ,
6765 expectedVert : VerticalTop ,
6866 },
6967 {
7068 name : "text-center-middle" ,
7169 input : "text-center-middle" ,
72- expectedHoriz : align . Center ,
70+ expectedHoriz : Center ,
7371 expectedVert : VerticalMiddle ,
7472 },
7573 {
7674 name : "text-right-bottom" ,
7775 input : "text-right-bottom" ,
78- expectedHoriz : align . Right ,
76+ expectedHoriz : Right ,
7977 expectedVert : VerticalBottom ,
8078 },
8179
8280 // Complex style strings (should extract alignment)
8381 {
8482 name : "style with text-center" ,
8583 input : "font-bold text-center bg-gray-100" ,
86- expectedHoriz : align . Center ,
84+ expectedHoriz : Center ,
8785 expectedVert : VerticalMiddle ,
8886 },
8987 {
9088 name : "style with align-top" ,
9189 input : "w-[200px] align-top font-mono" ,
92- expectedHoriz : align . Left ,
90+ expectedHoriz : Left ,
9391 expectedVert : VerticalTop ,
9492 },
9593 {
9694 name : "style with both alignments" ,
9795 input : "text-right align-bottom font-bold" ,
98- expectedHoriz : align . Right ,
96+ expectedHoriz : Right ,
9997 expectedVert : VerticalBottom ,
10098 },
10199
102100 // No alignment specified (defaults)
103101 {
104102 name : "no alignment" ,
105103 input : "font-bold bg-gray-100" ,
106- expectedHoriz : align . Left ,
104+ expectedHoriz : Left ,
107105 expectedVert : VerticalMiddle ,
108106 },
109107
110108 // Empty string
111109 {
112110 name : "empty string" ,
113111 input : "" ,
114- expectedHoriz : align . Left ,
112+ expectedHoriz : Left ,
115113 expectedVert : VerticalMiddle ,
116114 },
117115
118116 // Multiple alignment classes (last one should win for conflicting properties)
119117 {
120118 name : "multiple horizontal alignments" ,
121119 input : "text-left text-center text-right" ,
122- expectedHoriz : align . Right ,
120+ expectedHoriz : Right ,
123121 expectedVert : VerticalMiddle ,
124122 },
125123 {
126124 name : "multiple vertical alignments" ,
127125 input : "align-top align-middle align-bottom" ,
128- expectedHoriz : align . Left ,
126+ expectedHoriz : Left ,
129127 expectedVert : VerticalBottom ,
130128 },
131129 }
@@ -149,31 +147,31 @@ func TestRealWorldStyleStrings(t *testing.T) {
149147 tests := []struct {
150148 name string
151149 input string
152- expectedHoriz align. Type
150+ expectedHoriz Alignment
153151 expectedVert VerticalAlign
154152 }{
155153 {
156154 name : "table header style" ,
157155 input : "font-bold bg-gray-800 text-white text-center align-middle" ,
158- expectedHoriz : align . Center ,
156+ expectedHoriz : Center ,
159157 expectedVert : VerticalMiddle ,
160158 },
161159 {
162160 name : "table cell style" ,
163161 input : "w-[20ch] text-left align-middle font-medium" ,
164- expectedHoriz : align . Left ,
162+ expectedHoriz : Left ,
165163 expectedVert : VerticalMiddle ,
166164 },
167165 {
168166 name : "price column style" ,
169167 input : "w-[10ch] text-right align-middle font-mono" ,
170- expectedHoriz : align . Right ,
168+ expectedHoriz : Right ,
171169 expectedVert : VerticalMiddle ,
172170 },
173171 {
174172 name : "status column style" ,
175173 input : "w-[12ch] text-center align-top font-bold text-green-600" ,
176- expectedHoriz : align . Center ,
174+ expectedHoriz : Center ,
177175 expectedVert : VerticalTop ,
178176 },
179177 }
0 commit comments