|
2 | 2 |
|
3 | 3 | use SolutionForest\InspireCmsVisualEditor\Blocks\Contracts\BlockInterface; |
4 | 4 | use SolutionForest\InspireCmsVisualEditor\Blocks\Contracts\ContainerBlockInterface; |
| 5 | +use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ButtonBlock; |
| 6 | +use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ColumnBlock; |
5 | 7 | use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ContainerBlock; |
6 | | -use SolutionForest\InspireCmsVisualEditor\Blocks\Types\SectionBlock; |
| 8 | +use SolutionForest\InspireCmsVisualEditor\Blocks\Types\DividerBlock; |
7 | 9 | use SolutionForest\InspireCmsVisualEditor\Blocks\Types\GridBlock; |
8 | | -use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ColumnBlock; |
9 | 10 | use SolutionForest\InspireCmsVisualEditor\Blocks\Types\HeadingBlock; |
10 | | -use SolutionForest\InspireCmsVisualEditor\Blocks\Types\TextBlock; |
11 | | -use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ButtonBlock; |
12 | 11 | use SolutionForest\InspireCmsVisualEditor\Blocks\Types\ImageBlock; |
| 12 | +use SolutionForest\InspireCmsVisualEditor\Blocks\Types\SectionBlock; |
13 | 13 | use SolutionForest\InspireCmsVisualEditor\Blocks\Types\SpacerBlock; |
14 | | -use SolutionForest\InspireCmsVisualEditor\Blocks\Types\DividerBlock; |
| 14 | +use SolutionForest\InspireCmsVisualEditor\Blocks\Types\TextBlock; |
15 | 15 | use SolutionForest\InspireCmsVisualEditor\Enums\BlockCategory; |
16 | 16 |
|
17 | 17 | describe('Layout Blocks', function () { |
18 | 18 | describe('ContainerBlock', function () { |
19 | | - beforeEach(fn () => $this->block = new ContainerBlock()); |
| 19 | + beforeEach(fn () => $this->block = new ContainerBlock); |
20 | 20 |
|
21 | 21 | it('implements BlockInterface', function () { |
22 | 22 | expect($this->block)->toBeInstanceOf(BlockInterface::class); |
|
58 | 58 | }); |
59 | 59 |
|
60 | 60 | describe('SectionBlock', function () { |
61 | | - beforeEach(fn () => $this->block = new SectionBlock()); |
| 61 | + beforeEach(fn () => $this->block = new SectionBlock); |
62 | 62 |
|
63 | 63 | it('has correct type', function () { |
64 | 64 | expect($this->block->getType())->toBe('section'); |
|
74 | 74 | }); |
75 | 75 |
|
76 | 76 | describe('GridBlock', function () { |
77 | | - beforeEach(fn () => $this->block = new GridBlock()); |
| 77 | + beforeEach(fn () => $this->block = new GridBlock); |
78 | 78 |
|
79 | 79 | it('has correct type', function () { |
80 | 80 | expect($this->block->getType())->toBe('grid'); |
|
95 | 95 | }); |
96 | 96 |
|
97 | 97 | describe('ColumnBlock', function () { |
98 | | - beforeEach(fn () => $this->block = new ColumnBlock()); |
| 98 | + beforeEach(fn () => $this->block = new ColumnBlock); |
99 | 99 |
|
100 | 100 | it('has correct type', function () { |
101 | 101 | expect($this->block->getType())->toBe('column'); |
|
113 | 113 |
|
114 | 114 | describe('Basic Blocks', function () { |
115 | 115 | describe('HeadingBlock', function () { |
116 | | - beforeEach(fn () => $this->block = new HeadingBlock()); |
| 116 | + beforeEach(fn () => $this->block = new HeadingBlock); |
117 | 117 |
|
118 | 118 | it('implements BlockInterface', function () { |
119 | 119 | expect($this->block)->toBeInstanceOf(BlockInterface::class); |
|
146 | 146 | }); |
147 | 147 |
|
148 | 148 | describe('TextBlock', function () { |
149 | | - beforeEach(fn () => $this->block = new TextBlock()); |
| 149 | + beforeEach(fn () => $this->block = new TextBlock); |
150 | 150 |
|
151 | 151 | it('has correct type', function () { |
152 | 152 | expect($this->block->getType())->toBe('text'); |
|
169 | 169 | }); |
170 | 170 |
|
171 | 171 | describe('ButtonBlock', function () { |
172 | | - beforeEach(fn () => $this->block = new ButtonBlock()); |
| 172 | + beforeEach(fn () => $this->block = new ButtonBlock); |
173 | 173 |
|
174 | 174 | it('has correct type', function () { |
175 | 175 | expect($this->block->getType())->toBe('button'); |
|
198 | 198 | }); |
199 | 199 |
|
200 | 200 | describe('ImageBlock', function () { |
201 | | - beforeEach(fn () => $this->block = new ImageBlock()); |
| 201 | + beforeEach(fn () => $this->block = new ImageBlock); |
202 | 202 |
|
203 | 203 | it('has correct type', function () { |
204 | 204 | expect($this->block->getType())->toBe('image'); |
|
224 | 224 |
|
225 | 225 | describe('Utility Blocks', function () { |
226 | 226 | describe('SpacerBlock', function () { |
227 | | - beforeEach(fn () => $this->block = new SpacerBlock()); |
| 227 | + beforeEach(fn () => $this->block = new SpacerBlock); |
228 | 228 |
|
229 | 229 | it('has correct type', function () { |
230 | 230 | expect($this->block->getType())->toBe('spacer'); |
|
247 | 247 | }); |
248 | 248 |
|
249 | 249 | describe('DividerBlock', function () { |
250 | | - beforeEach(fn () => $this->block = new DividerBlock()); |
| 250 | + beforeEach(fn () => $this->block = new DividerBlock); |
251 | 251 |
|
252 | 252 | it('has correct type', function () { |
253 | 253 | expect($this->block->getType())->toBe('divider'); |
|
265 | 265 |
|
266 | 266 | describe('Block prop validation', function () { |
267 | 267 | it('validates required props', function () { |
268 | | - $block = new HeadingBlock(); |
| 268 | + $block = new HeadingBlock; |
269 | 269 | $errors = $block->validateProps([]); |
270 | 270 |
|
271 | 271 | // Content should be required |
272 | 272 | expect($errors)->toBeArray(); |
273 | 273 | }); |
274 | 274 |
|
275 | 275 | it('passes validation with valid props', function () { |
276 | | - $block = new HeadingBlock(); |
| 276 | + $block = new HeadingBlock; |
277 | 277 | $errors = $block->validateProps([ |
278 | 278 | 'content' => 'Valid Heading', |
279 | 279 | 'level' => 2, |
|
0 commit comments