@@ -110,13 +110,62 @@ public function it_can_create_datetime_field()
110
110
}
111
111
112
112
/** @test */
113
- public function it_can_create_text_field ()
113
+ public function it_can_create_file_field ()
114
114
{
115
- $ field = Fields \Text::make ('name ' );
116
- $ this ->assertInstanceOf (Fields \Text::class, $ field );
115
+ $ field = Fields \File::make ('name ' );
116
+ $ this ->assertInstanceOf (Fields \File::class, $ field );
117
+ $ this ->assertEquals ('upload ' , $ field ->getType ());
118
+ // TODO: add more file field test
119
+ }
120
+
121
+ /** @test */
122
+ public function it_can_create_hidden_field ()
123
+ {
124
+ $ field = Fields \Hidden::make ('name ' );
125
+ $ this ->assertInstanceOf (Fields \Hidden::class, $ field );
126
+ $ this ->assertEquals ('hidden ' , $ field ->getType ());
127
+ }
128
+
129
+ /** @test */
130
+ public function it_can_create_image_field ()
131
+ {
132
+ $ field = Fields \Image::make ('name ' );
133
+ $ this ->assertInstanceOf (Fields \Image::class, $ field );
134
+ $ this ->assertEquals ('upload ' , $ field ->getType ());
135
+ }
136
+
137
+ /** @test */
138
+ public function it_can_create_number_field ()
139
+ {
140
+ $ field = Fields \Number::make ('name ' );
141
+ $ this ->assertInstanceOf (Fields \Number::class, $ field );
117
142
$ this ->assertEquals ('text ' , $ field ->getType ());
118
143
}
119
144
145
+ /** @test */
146
+ public function it_can_create_password_field ()
147
+ {
148
+ $ field = Fields \Password::make ('name ' );
149
+ $ this ->assertInstanceOf (Fields \Password::class, $ field );
150
+ $ this ->assertEquals ('password ' , $ field ->getType ());
151
+ }
152
+
153
+ /** @test */
154
+ public function it_can_create_radio_field ()
155
+ {
156
+ $ field = Fields \Radio::make ('name ' );
157
+ $ this ->assertInstanceOf (Fields \Radio::class, $ field );
158
+ $ this ->assertEquals ('radio ' , $ field ->getType ());
159
+ }
160
+
161
+ /** @test */
162
+ public function it_can_create_read_only_field ()
163
+ {
164
+ $ field = Fields \ReadOnlyField::make ('name ' );
165
+ $ this ->assertInstanceOf (Fields \ReadOnlyField::class, $ field );
166
+ $ this ->assertEquals ('readonly ' , $ field ->getType ());
167
+ }
168
+
120
169
/** @test */
121
170
public function it_can_create_select_field ()
122
171
{
@@ -133,5 +182,36 @@ public function it_can_create_select2_field()
133
182
$ this ->assertEquals ('select2 ' , $ field ->getType ());
134
183
}
135
184
185
+ /** @test */
186
+ public function it_can_create_text_field ()
187
+ {
188
+ $ field = Fields \Text::make ('name ' );
189
+ $ this ->assertInstanceOf (Fields \Text::class, $ field );
190
+ $ this ->assertEquals ('text ' , $ field ->getType ());
191
+ }
136
192
193
+ /** @test */
194
+ public function it_can_create_textarea_field ()
195
+ {
196
+ $ field = Fields \TextArea::make ('name ' );
197
+ $ this ->assertInstanceOf (Fields \TextArea::class, $ field );
198
+ $ this ->assertEquals ('textarea ' , $ field ->getType ());
199
+
200
+ $ field ->rows (5 );
201
+ $ this ->assertEquals ('5 ' , $ field ->attr ['rows ' ]);
202
+
203
+ $ field ->cols (5 );
204
+ $ this ->assertEquals ('5 ' , $ field ->attr ['cols ' ]);
205
+ }
206
+
207
+ /** @test */
208
+ public function it_can_create_time_field ()
209
+ {
210
+ $ field = Fields \Time::make ('name ' );
211
+ $ this ->assertInstanceOf (Fields \Time::class, $ field );
212
+ $ this ->assertEquals ('datetime ' , $ field ->getType ());
213
+ $ this ->assertEquals ('name ' , $ field ->name );
214
+ $ this ->assertEquals ('Name ' , $ field ->label );
215
+ $ this ->assertEquals ('hh:mm a ' , $ field ->format );
216
+ }
137
217
}
0 commit comments